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

Implement machine-applicable suggestions in diagnostics #392

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mcy
Copy link
Member

@mcy mcy commented Dec 13, 2024

This PR adds report.SuggestEdits, which allows diagnostics to suggest changes to an annotated span. This will be used for surfacing quick-fixes in the LSP (for example, for suggesting deleting unused imports, adding a syntax declaration, adding missing field numbers, and so on).

The compiler is also able to render these as a simple diff, similar to some of rustc's diagnostics. I've tried to keep the data model simple: no diffing actually happens, the diagnostics are expected to generate the diffs manually. All the renderer does is convert the edits into hunks to show to the user. This PR contains examples in the lexer that shows how it is meant to be used.

@mcy mcy requested a review from jhump December 13, 2024 22:06
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.

1 participant