Skip to content

Java project symbol search does not include JDK and external dependency symbols #278

Closed

Description

@harnocca

Relevance Confirmation

  • I confirmed that this is not an issue with the Eclipse JDT Language Server itself

What happened?

When using Zed's Project Symbol Search in a Java project, symbols from the Java standard library and external dependencies are not included in the search results.

For example, searching for String, System, or Object returns no results. Classes from external libraries imported through Gradle dependencies are also missing.

However, symbols from files inside my own workspace are indexed correctly: features such as Go to Definition work as expected for JDK classes and external dependencies, indicating that JDTLS has access to the required classpath information.

This issue appears to be limited to Project Symbol Search and does not affect symbol resolution or navigation.
In comparison, when I'm in a C Project in Zed, this feature seems to be working fine, showing symbols from stdlib, stdio when searched.

What did you expect to happen?

I expected Project Symbol Search to include symbols from the Java standard library and external dependencies, similar to how it works in C projects or in Neovim with the same JDTLS setup.

For example, searching for String, Object, System, or classes from Gradle dependencies should return their declarations.

Environment

Zed: v1.9.0
Platform: Fedora 44
Java: OpenJDK 21.0.11
Plugin: v6.8.21

Activity

  1. added theissue type on Jul 7, 2026
  2. wodadehencou commented on Jul 14, 2026

    @wodadehencou

    same bug.
    Zed:1.10.3
    Platform: OSX
    Java: openjdk@21 for jdtls, openjdk@11 for project
    Plugin: v6.8.21

  3. wodadehencou commented on Jul 17, 2026

    @wodadehencou

    I can import external packages, but can not find jdk. Below is Claude advice, and fix my problem.


    诊断结论

    你报错的根因就是 runtimes 里 JavaSE-11 的 path 指向了残缺的 Homebrew keg 目录 /opt/homebrew/opt/openjdk@11。那个目录虽有 bin/java,但没有 release 文件、没有 lib/modules,不是合法的 JDK Home。JDTLS 校验失败后丢弃该 runtime,项目就失去了 JRE 系统模块,于是连 java.io.Serializable 这种自带类都"cannot be resolved"(而第三方库来自 Maven 依赖 jar,不受影响,所以它们正常)。

    已改动(~/.config/zed/settings.json)

    两处都从残缺路径改成了完整 JDK Home,且用稳定软链形式(升级补丁版本不会失效):

    键 旧值 新值
    lsp.jdtls.settings.java_home(跑 JDTLS 进程的 JDK) /opt/homebrew/opt/openjdk@21 .../openjdk@21/libexec/openjdk.jdk/Contents/Home
    runtimes → JavaSE-11(项目编译 runtime) /opt/homebrew/opt/openjdk@11 .../openjdk@11/libexec/openjdk.jdk/Contents/Home

    项目 pom 声明 java.version=11,与 JavaSE-11(现为完整路径、default)精确匹配。

    你需要做的

    配置改动 JDTLS 不会热加载,必须:

    1. 在 Zed 里 restart language server(命令面板 editor: restart language server),或直接重启 Zed;
    2. 如果还不行,清一下 JDTLS 的项目缓存(它把索引结果缓存了,可能仍记着旧的坏 runtime),然后重新打开项目让它重建索引。

    temurin-8 那条(JavaSE-1.8)路径是完整的、没问题,保留不动。

    要不要我把这个坑记进 memory —— "Homebrew keg 目录 /opt/homebrew/opt/openjdk@N 不是合法 JDK Home,JDTLS/java_home 必须用其下的 libexec/openjdk.jdk/Contents/Home"?这对你以后配 Java 工具挺容易再踩。

  4. tartarughina commented on Jul 19, 2026

    @tartarughina
    Collaborator

    @harnocca thanks for raising this up. This is a known issue between JDTLS and Zed.

    // Send:
    {"jsonrpc":"2.0","id":27,"method":"workspace/symbol","params":{"query":"pip"}}
    
    // Receive:
    {"id":27,"jsonrpc":"2.0","result":[{"containerName":"sun.nio.ch","kind":5,"location":{"range":{"end":{"character":0,"line":0},"start":{"character":0,"line":0}},"uri":"jdt://contents/java.base/sun.nio.ch/PipeImpl.java?=java_1e59299c/%5C/Library%5C/Java%5C/JavaVirtualMachines%5C/amazon-corretto-25.jdk%5C/Contents%5C/Home%5C/lib%5C/jrt-fs.jar%60java.base=/javadoc_location=/https:%5C/%5C/docs.oracle.com%5C/en%5C/java%5C/javase%5C/25%5C/docs%5C/api%5C/=/%3Csun.nio.ch%28PipeImpl.class"},"name":"PipeImpl"}...
    

    As you can see the response from JDTLS comes back as a jdt:// URI. Zed is not able to handle such and the final result is to show an empty list for symbols.

    Symbols coming from your project on the other hand are resolved with a file:// URI therefore Zed is able to retrieve and show you those informations.

    Our proxy is already handling some decompilation requests but symbols requests are not yet included. See how we achieve decompilation here.

    I'll mark this as a feature request.

  5. changed the issue type fromtoon Jul 19, 2026
  6. self-assigned this
    on Jul 19, 2026
  7. tartarughina commented on Aug 3, 2026

    @tartarughina
    Collaborator

    Feature added in #296

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

Metadata

Metadata

Assignees

Labels

language-serverRelated to the language server.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions