Skip to content
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

Implemented error recovery support in parametric language servers #511

Open
wants to merge 8 commits into
base: error-recovery/rascal
Choose a base branch
from

Conversation

PieterOlivier
Copy link

This PR leverages the error recovery support in TextDocumentService to also support error recovery for parametric language services.
The Pico demo has been extended with error recovery support.

The first step when supporting error recovery is to change the parser to do error recovery:

set[LanguageService] picoLanguageServer() = {
    parsing(parser(#start[Program], allowRecovery=true, allowAmbiguity=false)),

After that, the individual services need to be able to work even when error trees are present. In case of Pico, only a small change was needed to picoDocumentSymbolService, all other services kept working without changes.

Copy link
Contributor

@sungshik sungshik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The analyzer runs on parse trees with errors! 😲 That's beyond my expectations. Really cool 🙂 There are some inconsistencies between analyzer diagnostics and the outline, though, so that requires some additional tweaking. I suspect it might be a bug in version management of diagnostics; see the comment below for more details.

@sungshik
Copy link
Contributor

I fixed the analyzer issue (see comment), but I'm not sure if it addresses all potential issues in the analyzer. Remaining questions:

@PieterOlivier
Copy link
Author

PieterOlivier commented Nov 13, 2024

I think in this case everything works becuase lexicals can never be error trees.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants