-
-
Notifications
You must be signed in to change notification settings - Fork 217
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
Slurping anonymous function shorthand causes invalid syntax #883
Comments
Good recording. Looks like it could be a more general root cause there, but my brain hasn't started yet, so can't really grasp it. |
I have a request for you, @bpringe . 😄 These images and gifs are very good for showing what is going on. To go with them I want to have the text as well. It's easy to get it wrong when retyping it. Anyway, I just tried this. It is the formatting that is causing the invalid syntax. Or, rather, it is at the formatting step that this happens. Like so:
Not sure where the cursor displacements happen, doing thie formatting step in isolation doesn't provoke it. But it seems it happens after the formatting, because the enclosing list does not get formatted when slurping. If we check what it is the formatter gets as input we might be able to pinpoint this. Not sure what the fix is here. Maybe adding a space where the opening paren were as part of the slurp... |
I'll try to remember to provide the text next time 😄
I think this would actually make sense. Without having thought about it much, it seems like in any case, if slurp is performed and the thing immediately before the cursor is not an open/close token (and maybe some other things?), then a space can/should be placed there.
These are just a couple of examples to demonstrate. We'd need to spend some time thinking about other cases. |
And also the same thing for slurping the other way, of course. |
Since we format after the slurp we can probably add the space unconditionally and rely on the formatter to clean up extraneous whitespace. |
Is this something to be fixed in the formatter? I mean should the formatter remove extra spaces in that situation? |
It is that we use |
|
Just came across this randomly and wanted to record it before it gets lost in the void. In the gif below, I type
(.then)
and then hit the shortcut for slurp sexp forward (and that's it). You can see the#
stays next to.then
and the cursor for some reason jumps backwards out of the list.The text was updated successfully, but these errors were encountered: