Add infrastructure to narrow down diagnostic ranges #10500
Labels
A-diagnostics
diagnostics / error reporting
S-actionable
Someone could pick this issue up and work on it right now
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 removediagnostics_display_range
fromSemancis
entirely, and instead implement a helper for that inide_diagnostics
directly, such that it supports sub-node ranges.The text was updated successfully, but these errors were encountered: