-
Notifications
You must be signed in to change notification settings - Fork 842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack ghci should start with a project, even if there are two #1068
Comments
I think a PR to make this a nicer would be welcome, although should probably have a bit of discussion before deciding on the exact solution. |
I'll take a stab at a possible solution: (the wording here would obviously need some retooling:
Effectively communicate the same information and supply a prompt to choose between the options, with empty string defaulting to the first. |
@gambogi, for things like ghcid that doesn't really help. I'd still like it to not require user interaction - if it does I'll still have to write a separate script to start ghci. |
@ndmitchell I liked your original idea of setting the default in stack.yaml. I think we should modify the message to let the user know that they can set a default in stack.yaml too. @gambogi If you have not started working on this yet, I would definitely be willing to give this one a shot. |
@achernyak all yours |
It seems a bit magical to me to add default targets for ghci. If such a thing is added, maybe it'd make sense to also have it affect I like @gambogi 's suggestion, since GHCi is interactive, it seems fine to me to ask the user for input. If the user doesn't enter (0) or (1) and just presses enter, then we should get the current behavior (load neither). The main issue with adding this interactivity is if editor integrations don't expect it. Could be good to have a flag that disables the behavior.. So, feel free to implement @gambogi 's idea, and possibly open an issue about having a default-targets setting. Also, from the original issue:
It isn't true that it isn't going to do anything useful. It's just not going to load any Main modules. So, I don't think there should be a magic default - I don't like picking something random just because the choice is ambiguous. This leads to circumstances where users aren't sure why one thing works and another does not. |
@mgsloan Thanks for the direction. I will work towards your proposed solution. |
I restart ghci maybe every 10 mins. I drop in and out of it quickly. I also use ghcid which runs it headless. Anything which requires interactive behaviour on every start up is unworkable for me. Starting with nothing loaded is also problematic - I now have to :load the right thing, which is complex user interaction, and often different per project. With my existing .ghci scripts all this works out nicely. |
@mgsloan if that's the enter behavior it should probably appear first in the list of options (with its status as the default noted). |
I don't like the arbitrary feeling of "pick the first viable Main.hs". I do see the value of a sensible default, though. How about this approach to picking one:
|
@gambogi In that case, how would the user ask for "don't load any Main.hs"? I'm thinking the list should be ordered such that |
@mgsloan I agree with you that "don't load any Main.hs" should be an option. My point was it should be clear from the presented dialog that it is the first (and default on |
Ohh, I see! Yes, I agree with that. If we do add the defaulting, one issue is how to get back to having an interactive option. Might need a flag like |
Maybe we're going about this the wrong way. There is already a great place to put ghci specific options, namely a |
For the time being I am going to add interactivity with the default being do nothing. If we decide to add additional flags later, that can be part of a separate issue. |
@ndmitchell I am trying to reproduce this right now, but can't seem to get the same message you got. I tried both in a freshly created repo and directly in ghcid. Could you share anything extra that you did to get this behavior? |
I think it no longer reproduces directly due to the resolution of #1186 (comment). Now, it only defaults to loading the same things that |
Thanks, |
@ndmitchell There's a remaining bug before |
This error is a little annoying - it says it's not going to do anything useful, and the two ways of picking the useful behaviours are both quite annoying - they require me to remember command line flags every time. Instead, how about:
.cabal
file lexically, then people can reorder their.cabal
file to indicate a preference.stack.yaml
to record a default.The text was updated successfully, but these errors were encountered: