Repository navigation
Deduplicate call hierarchy call-site ranges - #65566
Daniel Rosenwasser (DanielRosenwasser) wants to merge 5 commits into
Conversation
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified in the call-hierarchy range deduplication change.
No open issues 🎉
What changed in this PR
Fixes #65526 by removing duplicate call-site ranges from the language server’s call hierarchy results while preserving distinct source occurrences.
Changes:
- Compact sorted incoming and outgoing
fromRangesto remove exact duplicates. - Add a fourslash regression test and baseline confirming one outgoing range for a single interface method call.
| File | Description |
|---|---|
tsc/testdata/baselines/reference/fourslash/callHierarchy/callHierarchyOutgoingInterfaceMethod.callHierarchy.txt |
Records the expected single outgoing call-site range. |
tsc/internal/ls/callhierarchy.go |
Deduplicates incoming and outgoing call-site ranges after sorting. |
tsc/internal/fourslash/tests/callHierarchyInterfaceMethod_test.go |
Adds regression coverage for an interface method call. |
Review effort: Balanced
|
Copilot this is probably fine in part, but part of the issue is that we doubly-add the same node based on how Let's add an exception to when the parent of a property/element access expression is the target of a call-like node (or have a flag on |
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Updated the collector to avoid recording a property/element access already used as a call-like target, and removed outgoing-range compaction. The focused regression and full validation pass. Commit: |
| } | ||
|
|
||
| slices.SortFunc(fromRanges, lsproto.CompareRanges) | ||
| fromRanges = slices.Compact(fromRanges) |
There was a problem hiding this comment.
Copilot for symmetry both sides should still have the Compact call.
There was a problem hiding this comment.
Restored slices.Compact for outgoing ranges to match incoming handling. Focused tests and npx hereby validate pass. Commit: fe07e61.
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Call hierarchy results could report the same source range multiple times when a call-site AST was reached through both a call expression and its target property access.
fromRanges, preserving distinct source occurrences while removing exact duplicates.