-
Notifications
You must be signed in to change notification settings - Fork 54
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
More help from the typechecker in constructing valid REPL inputs #1955
Comments
@byorgey I think we could improve a little even by highlighting only |
Yes, great idea. I would still love to have what is described in this issue (better error highlighting still does not help you know how to fix the error, or what should go in a hole) but that would be much better than the status quo. |
How, about showing the type of function the cursor is on? Also I think it would be helpful to see the current error text. |
Yes, that would make sense I think. We should already have some code in the LSP server which computes this, perhaps we could abstract it out into |
How about just showing the first line of the current error text, in the same space where the type is usually shown (i.e. the top right corner of the REPL panel)?
If you want to see the whole error message you can always hit Enter, it will be printed in the REPL, then you can hit Up and continue editing the input. |
I'm going to close this in favor of #2255 which I split out as a more specific issue. We did also get #1956 which helps a lot. The other idea in this thread was to show some summary of the current error message in the UR corner of the REPL, but I don't think we can do that and #2255 at the same time. Showing the type of the currently focused thing seems more useful than showing the current error message, especially if the error is due to an incomplete/in progress input. |
Is your feature request related to a problem? Please describe.
It's annoying when you are in the middle of typing something like
and you need to fill in the
...
, but you can't remember exactly what the type ofmyComplexFunction
is, but Swarm is no help because the entire thing does not typecheck so it is just highlighted in red.Describe the solution you'd like
I am not sure exactly what a solution would look like. Just brainstorming some ideas here.
What if there were key shortcuts that let you move the "current focus" inward + outward. For example if you have already typed
build {myComplexFunction }
with the cursor right aftermyComplexFunction
you could hit the "focus inward" key and it would switch to focusing on just the part inside the{}
(which could be indicated by different color highlighting). It could then show you the type that needs to go in the hole (Cmd Unit
) and the type of what you currently have (Some -> Complex -> Function -> Type -> Cmd Unit
). Maybe hitting "focus inward" one more time would switch to focusing just on the first argument tomyComplexFunction
.Describe alternatives you've considered
A simpler alternative would be the ability to have "typed holes" where you can put something like
_
or?
in place of missing subterms and have the system report their types to you. However, this would be kind of annoying (if you don't remember the type ofmyComplexFunction
you might not even remember how many arguments it needs, and even if you did it would be annoying to have to type a bunch of question marks), and it might be difficult to tell the question marks apart.The text was updated successfully, but these errors were encountered: