feat(proxy): support multi-level navigation from decompiled JAR classes - #305
Conversation
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: ckwang.
|
JDTLS reports classes inside jars with jdt:// URIs. The proxy already rewrites those into temporary decompiled .java files so Zed can open them, but navigation then stopped: Zed sends follow-up requests against the temporary file:// URI, which JDTLS does not understand. Persist the reverse mapping (file:// -> jdt://) next to each cached decompiled source, and rewrite incoming textDocument request URIs back to jdt:// before forwarding. Also suppress didOpen/didChange/didSave/didClose for decompiled-source worktrees so JDTLS never treats them as editable project files. The mapping lives on disk because Zed opens decompiled files in their own worktree, which spawns a fresh proxy process.
73d215f to
3de5084
Compare
|
We require contributors to sign our Contributor License Agreement, and we don't have @FanXingChunShui on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
| let mut name = target.as_os_str().to_os_string(); | ||
| name.push(".jdt-uri"); | ||
| PathBuf::from(name) |
There was a problem hiding this comment.
Consider to use set_file_name for a more streamlined operation
|
@FanXingChunShui Could you point to a readily available example where the issue you are addressing here exists? |
Summary
When JDTLS resolves a symbol that lives inside a JAR, it returns
jdt://URIs.java-lsp-proxyalready rewrites those into temporary decompiled.javafiles so Zed can open them, but navigation then stopped: Zed sends follow-up requests against the temporaryfile://URI, which JDTLS does not understand.This PR adds the reverse half of that mapping so navigation can continue from one decompiled class into another.
Changes
proxy-common: addfile_uri_to_path(inverse ofpath_to_file_uri).proxy(decompile.rs): persist afile:// -> jdt://mapping as a<name>.java.jdt-urisidecar next to each cached decompiled source.proxy(main.rs):textDocumentrequest URIs back fromfile://tojdt://before forwarding to JDTLS;didOpen/didChange/didSave/didClosefor decompiled-source worktrees so JDTLS never treats them as editable project files.The mapping is stored on disk rather than in memory because Zed opens decompiled files in their own worktree, which spawns a fresh
java-lsp-proxyprocess.Validation
cargo test -p proxy-common -p java-lsp-proxy: 53 + 11 tests pass (including 5 new tests).cargo clippy -p proxy-common -p java-lsp-proxy --all-targets: clean.cargo fmt --all: clean.cargo check -p gradle-lsp-bridge: passes.