[BUG] LSP goToDefinition should support jdt:// URIs for Java jar dependency navigation
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When using the Java language server (jdtls) through Claude Code's LSP integration, goToDefinition cannot navigate into classes that live inside jar dependencies. It returns "No definition found."
The hover operation works fine for these same symbols. It correctly identifies the type and its source jar. The problem is only with goToDefinition.
Root Cause:
When you call goToDefinition on a symbol from a jar dependency, jdtls returns a location with a jdt:// URI instead of a file:// URI. This is a custom URI scheme that jdtls uses to represent
class files inside jars. Claude Code's LSP client does not recognize this scheme, so it reports no definition found.
VSCode handles this by:
- Recognizing the jdt:// URI in the goToDefinition response
- Sending a java/classFileContents request back to jdtls to get the decompiled source
- Displaying the decompiled source as a read-only virtual file
The decompiler (FernFlower) is already bundled with jdtls. No extra setup is needed on the server side. The only missing piece is client-side handling of the jdt:// URI
What Should Happen?
goToDefinition on a jar class should return the decompiled source of that class, similar to how VSCode and other editors handle it.
Java projects rely heavily on external libraries. Without jar navigation, Claude Code cannot inspect dependency APIs, understand return types, or verify method signatures. This forces workarounds like manually unzipping jars or maintaining documentation files with dependency APIs.
This would be a big improvement for all Java users of Claude Code.
Error Messages/Logs
Steps to Reproduce
- Set up a Java project with jdtls as the LSP server (via a plugin)
- Open a file that imports a class from a jar dependency (not project source)
- Run goToDefinition on that class name
- Result: "No definition found"
- Run hover on the same symbol
- Result: correctly shows the fully qualified class name and source jar
Claude Model
None
Is this a regression?
No
Last Working Version
_No response_
Claude Code Version
2.1.81
Platform
AWS Bedrock
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗