Repository navigation
fix(analyser): move the spans of diagnostic details into the file - #1049
Merged
Merged
Conversation
…il-spans-in-file # Conflicts: # crates/pgls_analyser/src/lib.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #952's "Not covered". A lint rule reports spans relative to its statement, and
Analyser::analysemoves the diagnostic's span into the file. The spans of its details (LinterDiagnostic::detail(Some(span), ..)andlabel) stayed relative to the statement, while the printer and the LSP read them as file offsets. No rule passes a detail span today, but the first one that does would show its related information at the wrong place.What changed
LinterDiagnostic::move_into_file(statement_range)moves the span of the diagnostic and the spans of its details into the file;analysecalls it where it moved the span before. The docs oflabel/detailsay that the span is relative to the statement, like the diagnostic's span.#952 is open and conflicting with main; it doesn't cover this item, so this PR is based on main. Its
debug_assert_in_statementcould check the detail spans too once both are in.Tests
diagnostics_move_into_the_file: a diagnostic with a span, a detail with a span and one without, and a diagnostic without a span (it points at the statement).cargo test -p pgls_analyser,cargo clippy --workspace --all-targets -- -D warnings.