fix(lsp): skip widening for indexed source files (#2052)

Fixes #2034

Call hierarchy, Find Usages and rename widen a server's answer by opening project files that mention the symbol's name and asking again. For JDT LS those files are mostly sources it already analyses, so nearly every incoming-calls request ran a second, slow round before anything was shown. Widening now asks the server which candidates are already in its analysis scope (optional `openidea.workspace.coveredFiles` command, served by the bundled JDT extension using the live source search scope) and only opens the rest; a missing or failing answer keeps the previous behaviour. Covers call hierarchy, references and rename. Hierarchy on a multi-module Maven fixture: median 703 ms → 224 ms, one query round.
This commit is contained in:
l0ng-ai authored and GitHub committed 2026-11-08 03:53:23 +08:00
1 parent af19880390
commit 292ddc4d2a
9 files changed
+270 -6

No files matched your search

+12 -1
View File
@@ -20,6 +20,13 @@ first and runs the full search after it. Rows in library classes (`jdt:` URIs) c
line as `text`, from the contents the client would request for the class, so the client
need not fetch thousands of class files to show them.
`openidea.workspace.coveredFiles([candidateUri, ...])` returns candidate URIs already
covered by the current JDT source search scope. It checks imported compilation units,
classpath inclusion/exclusion rules and test-source policy; it does not infer coverage
from directory names. References, rename and incoming calls leave those files closed
and only widen with the remaining candidates. A missing or failing command retains
widening. The result is query-local, so imports and classpath changes need no cache invalidation.
## Search plan and access semantics
For source fields on the verified JDT LS implementation, a single plan merges
@@ -69,7 +76,7 @@ is not a claim of full IntelliJ feature parity.
## Rebuild and delivery
The checked-in jar is embedded by ide-sdk `include_bytes!`, installed as
`java-usages-1.8.0.jar`, and added alongside existing initialization bundles.
`java-usages-1.9.0.jar`, and added alongside existing initialization bundles.
Users need no compiler, Maven or Python. Manifest/install version must change
when replacing the bundle because OSGi caches bundles.
@@ -108,6 +115,10 @@ configuration index (until the JAR or the project's classpath changes), so a sou
longer resolves every Spring Boot property again; its reproducible SHA-256 is
`728ab33b5e01fa5e496818f25ddbc487458a92339026899b0e22abda5adfd67b`.
Version 1.9.0 adds the analysis-scope command to avoid redundant semantic queries;
its reproducible SHA-256 is
`ae04182d6a86dfdd6f6befaaeb28907fd9e4c022ceedb445f0b32ea917dca379`.
```sh
export PATH=/path/to/jdk25/bin:$PATH
python3 java/java-usages/build.py /path/to/jdtls