-
-
Notifications
You must be signed in to change notification settings - Fork 782
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
Add fault tolerant parsing for case
expressions
#3978
Comments
Love this! It would be a huge dx win |
Definitely! |
I can think of two ways of approaching this, which one do you think would be best?
To implement 1, one would have to change the parser and nothing much besides that, everything else should already be in place to make it work. I'm not really sure how 2 could be implemented, I haven't looked much at the completer |
1 is probably easier, that's how we handle We would need to be careful though, because some code actions (such as fill missing patterns) rely on the syntax being well formed, and saying that this syntax is valid could lead to odd behaviour there. |
That's great to know! Would you like to work on this or can I give it a try today? |
I'm still away for a the next couple of days, so I won't be able to work on it much until next week. Go for it if you want to! |
Sounds good to me, but we are going to need to introduce some capability for fault tolerant parsing in the future also. |
That's true. We could either do that as part of this, or separately, in preparation for future fault tolerance. I presume we would do it in a similar way to analysis fault tolerance? |
A small report, I tried going for the easy implementation but as usual the devil's in the details 😆 case 1, test {
}
|
Interesting. Surely you could write it in such a way that it would be greedy and parse all subjects before checking for curly braces? |
Yeah I'll try that! |
Currently,
case something
is a syntax error (obviously). The problem is, the language server cannot provide autocomplete when typing the subject of the case expression. We could make this fault tolerant in the same way asrecord.
, to allow for a better LSP experience.The text was updated successfully, but these errors were encountered: