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

Report error nodes in LSP #992

Merged
merged 1 commit into from
Feb 14, 2024
Merged

Report error nodes in LSP #992

merged 1 commit into from
Feb 14, 2024

Conversation

STRd6
Copy link
Contributor

@STRd6 STRd6 commented Feb 14, 2024

The LSP now reports parse errors. Unfortunately they don't have location information yet so they will only appear at the top of the file. Eventually we can add location info to error nodes, apply the sourcemapping, update the LSP to check for this location, and then they will appear in the proper place.

Copy link
Collaborator

@edemaine edemaine left a comment

Choose a reason for hiding this comment

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

Seems like a good start!

I agree we should eventually do the source mapping. Ideally within main.civet (during gen?) so we can use it in all contexts.

errors,
})

return Object.assign(result, { errors })
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seeing this interface makes me wonder whether Civet.compile should directly return errors along with code and sourceMap, instead of (or in addition to?) modifying options. Is the issue that compile doesn't return an object when not requesting sourceMap?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think in the long run the errors can be returned alongside the sourceMap. When not requesting a sourceMap we should still throw because it only returns the compiled code as a string.

@STRd6 STRd6 merged commit 8a18d64 into main Feb 14, 2024
3 checks passed
@STRd6 STRd6 deleted the lsp-parse-errors branch February 14, 2024 04:51
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