LspError.data missing #[serde(default)] swallows the real jdtls error
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 88/100
Research direction
The struct LspError is defined in src/lsp.rs and the untagged LspResponse enum that wraps it is where parsing fails. Start by reading those two definitions, then add #[serde(default)] to the data field. To verify, send a proxy response with an error object that has no data key and confirm the message field reaches the user unchanged.
Written by the indexing model from the issue text.
Description
Summary
src/lsp.rs defines
pub struct LspError {
code: i64,
message: String,
data: Value, // no #[serde(default)]
}
LSP allows error.data to be omitted. When jdtls returns an error without data, the Error variant fails to deserialize, and since LspResponse is an untagged enum, the whole parse fails with:
Failed to parse response from LSP proxy: data did not match any variant of untagged enum LspResponse
Impact
The actual error message is swallowed. In our case the real response was:
{"error":{"code":-32601,"message":"No delegateCommandHandler for vscode.java.resolveMainClass"},"id":"...","jsonrpc":"2.0"}
but Zed surfaced the misleading serde error, which pointed everyone (including maintainers reading our report) at "protocol/proxy problems" instead of the broken debug plugin (see #324). This cost a long debugging session.
Repro
- Start a debug session while the java-debug bundle is broken/unloaded (e.g. #324)
- Or directly:
curl -X POST http://127.0.0.1:<proxy-port>/ -d '{"method":"workspace/executeCommand","params":{"command":"vscode.java.resolveMainClass","arguments":[]}}'— the response error has nodatafield
Fix
Add #[serde(default)] to data (one-liner) so the real message (No delegateCommandHandler ...) reaches the user.
- Dominant language
- Rust
- Stars
- 225
- Forks
- 47
- Avg merge
- 3h 51m
- Merged PRs (30d)
- 7
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from zed-extensions/java
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
zed-extensions/java#133 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
zed-extensions/java#324 ·
-
Difficulty 3/5 Half a day Newbie friendliness 45/100
zed-extensions/java#323 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
zed-extensions/java#272 · 6 comments ·
-
language-server
Difficulty 4/5 3-5 days Newbie friendliness 25/100
zed-extensions/java#246 · 4 comments ·
All issues in zed-extensions/java
Similar issues
-
bug file-compat priority: high
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
storytold/photocraft#11330 · 1 comment ·
Maintainers usually reply within 1 day
-
redis-compat
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
say: name hint should only fire on @tags, not bare words or text inside linksPossibly taken @morganparadis claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
CakeRepository/agentshangout#501 ·
-
area:ui could docs good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100