-
Notifications
You must be signed in to change notification settings - Fork 58
Allow for catch and finally in try expression to be on a new line #16
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
Conversation
I think that what's needed is a change to the external scanner's logic for inserting We need to do the same thing for |
This describes Scala's rules for automatic semicolon insertion.
|
f37efab
to
e0b0381
Compare
Cool, thanks a lot for the pointers @maxbrunsfeld. I think this should be ready to go! |
I'm not sure if this isn't trigger the build. It may be since this was already opened when the actions pr was merged that it doesn't register. Do you by chance want me to close this and reopen to try and trigger it? EDIT: Tried and that didn't work. I think I have a fix included for it an a commit here. |
- master | ||
pull_request: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took this from how we do it in Metals. https://github.com/scalameta/metals/blob/6001b60afb2774c342a73fea4856d42ff5fa5d1e/.github/workflows/ci.yml#L4-L6
Thanks! |
I noticed that
try_expression
s weren't quite looking right when they were on a new line. However, I'm having a hard time understanding exactly how to actually take the new line into account.To give an example.
This parses correctly and the
finally_clause
is recognized as part of thetry_expression
.However, if you simply bump the
catch
down a line to create:I then totally misses the
catch_clause
.This happen when using
finally
as well on a newline.So this seems to make sense to me:
tree-sitter-scala/grammar.js
Lines 540 to 545 in 262797b
Although I'm not really sure how that works with newlines. Do you maybe have any pointers or insights into what I'm missing here? I'd love to get a better understanding of what's going on here and start tackling some of these missing features for the Scala grammar. I'm increasingly wanting a complete grammar as all the great stuff around Neovim and tree-sitter is happening, and I feel like Scala is missing out!