Skip to content

Add infrastructure to narrow down diagnostic ranges #10500

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

Open
matklad opened this issue Oct 9, 2021 · 0 comments
Open

Add infrastructure to narrow down diagnostic ranges #10500

matklad opened this issue Oct 9, 2021 · 0 comments
Labels
A-diagnostics diagnostics / error reporting S-actionable Someone could pick this issue up and work on it right now

Comments

@matklad
Copy link
Member

matklad commented Oct 9, 2021

In #10499 and #10425 I've implemented some hacks to narrow down diagnostics range. "Remove this semicolon" diagnostics points to the whole expr_stmt, while we want to highlight only the ;. Similarly, for mismatch arg count we want to highlight only extra/missing args.

The impl there works for the common cases, but is wrong in general.

The overall problem is that diagnostic point to a syntax node in a potentially macro expanded file. We want to narrow this range down while still in the macro-expanded file, but then map it to the original file.

diagnostics_display_range doesn't support this API. We probably should remove diagnostics_display_range from Semancis entirely, and instead implement a helper for that in ide_diagnostics directly, such that it supports sub-node ranges.

@matklad matklad added S-actionable Someone could pick this issue up and work on it right now A-diagnostics diagnostics / error reporting labels Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics diagnostics / error reporting S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

1 participant