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

fix: panic with js lint plugins and invalid js syntax #28006

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

marvinhagemeister
Copy link
Contributor

Noticed that the LSP might panic during serialization when working on a file with a syntax error.

This PR changes the serialization so that invalid nodes are simply serialized to the invalid node 0. The plugin code treats the node with id 0 as an invalid node and will ignore it during visiting.

I'm not sure how to write a test for the LSP.

We should not panic when we're serializing an invalid AST during linting.
@marvinhagemeister marvinhagemeister merged commit 703fdd8 into main Feb 7, 2025
18 checks passed
@marvinhagemeister marvinhagemeister deleted the lint-lsp-crash branch February 7, 2025 11:35
bartlomieju pushed a commit that referenced this pull request Feb 12, 2025
Noticed that the LSP might panic during serialization when working on a
file with a syntax error.

This PR changes the serialization so that invalid nodes are simply
serialized to the invalid node `0`. The plugin code treats the node with
id `0` as an invalid node and will ignore it during visiting.

I'm not sure how to write a test for the LSP.
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.

2 participants