Repository navigation
Conversation
… and a type definition LSP4IJ asks for the references with includeDeclaration, so the references of a symbol include its declaration, and the type definition of a type is the type itself. The usage view merges the usages of a line only within a group of the same usage type, so Find Usages showed the declaration of a type three times: as a definition, as a reference and as a type definition. The deduplication dropped only a range that strictly contains another, so equal ranges stayed. A reference or a type definition whose file and range are those of a declaration or a definition is now skipped. The declarations, definitions, implementations and other references are listed as before. Fixes redhat-developer#729
|
Warning Review limit reachedThis review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry. Next included review available in 17 minutes. View limit details
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2215 +/- ##
==========================================
+ Coverage 54.59% 54.69% +0.09%
==========================================
Files 834 834
Lines 35385 35398 +13
Branches 7300 5549 -1751
==========================================
+ Hits 19320 19360 +40
+ Misses 13223 13195 -28
- Partials 2842 2843 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Combined, unchanged, with the other small fixes into #2219, one commit each, so that they take one review instead of six. |
Fixes #729
What
LSP4IJ asks for references with
includeDeclarationset, so the reference list repeats the declaration. The declaration of a type also comes back as its type definition. IntelliJ merges the usages of a line only within one usage-type group, so Find Usages listed the declaration three times: under Definitions, Type Definitions and References. That's what the Scala/Metals screenshot in the issue shows. The existing dedup drops only ranges that strictly contain another, so equal ranges stayed.Change
After the existing dedup,
LSPUsageSearcher.removeRepeatedDeclarationscollects the file and range of every declaration and definition. It drops the references and type definitions found at one of those locations.includeDeclarationand its TODO are unchanged.Not in this PR: a declaration and a definition at the same location are both kept, as before.
Tests
New
LSPUsageDeclarationOnceTest: the mock answers definition, type definition and references with the declaration's location.[Definitions (6,13), Type Definitions (6,13), References (6,13), References (17,24), References (36,43)].[Definitions (6,13), References (17,24), References (36,43)].The new test passes headless on IC 2024.2, 2025.3 and IU 2026.3.
usages.*andfeatures.references.*pass on all three platforms: 27 tests each, 0 failures, 0 skipped.Behaviour change