Repository navigation
Let DiagnosticManager take Locatables instead of Locations - #1878
Merged
Merged
Conversation
register() now accepts a Locatable (node/token) anywhere it took a Location, including relatedInformation. Only pos/end/source get kept, so the AST isn't retained, and nothing gets turned into a Location until getDiagnostics(). Suppressed diagnostics never get resolved at all. Also fixes register() never merging relatedInformation when the same diagnostic was registered again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Locatable version of `util.getLocation(a) ?? util.getLocation(b)`, for diagnostics that fall back to another node when the first one is synthetic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
They have no pos, so they were being stored (and returned) as if they were a Location. Check for a Location's uri/range instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tokens and nodes can have deprecated range/location getters (#1876), which made them look like a Location. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ic-locatables # Conflicts: # src/DiagnosticManager.spec.ts # src/DiagnosticManager.ts # src/util.spec.ts # src/util.ts
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.
DiagnosticManager.register()now takes aLocatable(node/token) anywhere it took aLocation, includingrelatedInformation. Onlypos/end/sourceget kept, so diagnostics don't hold onto the AST, and nothing gets resolved into aLocationuntilgetDiagnostics(). Suppressed diagnostics never get resolved.source.urigetDiagnostics()output is unchanged, still plainLocations for plugins/LSPlocation: util.getLocation(x)->location: x)Also fixes
register()never mergingrelatedInformationwhen the same diagnostic was registered again (the check was backwards).Benchmark:
v1(2ae472d) vs.v1+ all location PRs (#1845, #1865, #1866, #1867, #1868, #1876, #1878, #1879, #1880, #1881). Best of 5 runs. Diagnostics identical on every project.🤖 Generated with Claude Code