Skip to content

Deduplicate call hierarchy call-site ranges - #65533

Closed
Josué Barros (joshbarros) wants to merge 1 commit into
microsoft:mainfrom
joshbarros:fix/65526-callhierarchy-duplicate-ranges
Closed

Josué Barros (joshbarros) wants to merge 1 commit into
microsoft:mainfrom
joshbarros:fix/65526-callhierarchy-duplicate-ranges

Conversation

@joshbarros

Copy link
Copy Markdown

Fixes #65526

A single call site can be collected more than once for a declaration, so CallHierarchyIncomingCall and CallHierarchyOutgoingCall exposed duplicate identical fromRanges entries. For the report's one-call case, callHierarchy/outgoingCalls returned two copies of the same range.

Sorting already happens in convertCallSiteGroupToIncomingCall and convertCallSiteGroupToOutgoingCall; this compacts the sorted slice before building the response.

The new TestOutgoingCallHierarchyDoesNotDuplicateFromRanges uses the report's interface plus one method call and asserts a single fromRanges entry. 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 vet and the repo's gofmt: clean.

Drafted with assistance from an AI assistant. I reviewed the diff and ran the tests above.

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
Copilot AI balanced review requested due to automatic review settings November 16, 2026 18:03
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Nov 16, 2026
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Nov 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 fromRanges slices 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Duplicate callsite ranges for a single method call in callHierarchy/outgoingCalls

3 participants