Repository navigation
Deduplicate call hierarchy call-site ranges - #65533
Closed
Josué Barros (joshbarros) wants to merge 1 commit into
Closed
Josué Barros (joshbarros) wants to merge 1 commit into
Josué Barros (joshbarros) wants to merge 1 commit into
Conversation
A single call site can be collected more than once for a declaration, so CallHierarchyIncomingCall and CallHierarchyOutgoingCall exposed duplicate identical fromRanges entries. Compact the sorted ranges before building the response. Fixes microsoft#65526
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the call-hierarchy range deduplication change.
No open issues 🎉
What changed in this PR
Fixes #65526 by removing duplicate call-site ranges from incoming and outgoing call hierarchy responses in the language service.
Changes:
- Compact sorted
fromRangesslices to remove identical entries. - Add an LSP regression test confirming that a single method call produces exactly one outgoing range.
| File | Description |
|---|---|
tsc/internal/lsp/server_callhierarchy_test.go |
Adds regression coverage for duplicate outgoing call-site ranges. |
tsc/internal/ls/callhierarchy.go |
Deduplicates sorted ranges in incoming and outgoing call hierarchy responses. |
Review effort: Balanced
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.
Fixes #65526
A single call site can be collected more than once for a declaration, so
CallHierarchyIncomingCallandCallHierarchyOutgoingCallexposed duplicate identicalfromRangesentries. For the report's one-call case,callHierarchy/outgoingCallsreturned two copies of the same range.Sorting already happens in
convertCallSiteGroupToIncomingCallandconvertCallSiteGroupToOutgoingCall; this compacts the sorted slice before building the response.The new
TestOutgoingCallHierarchyDoesNotDuplicateFromRangesuses the report's interface plus one method call and asserts a singlefromRangesentry. It gets 2 without the change.Validation:
go test ./tsc/internal/lsp -run TestOutgoingCallHierarchyDoesNotDuplicateFromRanges -count=1: fails without the change, passes with it.go test ./tsc/internal/lsp ./tsc/internal/ls -count=1: pass.go vetand the repo'sgofmt: clean.Drafted with assistance from an AI assistant. I reviewed the diff and ran the tests above.