-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Send JSON-RPC error responses for unknown request methods #5044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Send JSON-RPC error responses for unknown request methods #5044
Conversation
The Language Server Protocol requires that all requests receive responses. Previously, ALE would silently ignore unknown JSON-RPC requests from language servers (like workspace/configuration), violating the LSP specification. Solution: - Modified the central message handler in ale#lsp#HandleMessage to track whether any handler processed each message - Added handler return values: handlers now return v:true when they process server-initiated requests/notifications - Only 2 handlers needed modification since most handle client request responses: * ale#lsp_linter#HandleLSPResponse (textDocument/publishDiagnostics, etc.) * ale#codefix#HandleLSPResponse (workspace/applyEdit) - Unknown requests now receive standard JSON-RPC error responses with code -32601 (Method Not Found) This ensures ALE is compliant with the LSP specification requirement that "Every processed request must send a response back to the sender." 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
The Language Server Protocol requires that all requests receive responses. Previously, ALE would silently ignore unknown JSON-RPC requests from language servers (like workspace/configuration), violating the LSP specification. Solution: - Modified the central message handler in ale#lsp#HandleMessage to track whether any handler processed each message - Added handler return values: handlers now return v:true when they process server-initiated requests/notifications - Only 2 handlers needed modification since most handle client request responses: * ale#lsp_linter#HandleLSPResponse (textDocument/publishDiagnostics, etc.) * ale#codefix#HandleLSPResponse (workspace/applyEdit) - Unknown requests now receive standard JSON-RPC error responses with code -32601 (Method Not Found) This ensures ALE is compliant with the LSP specification requirement that "Every processed request must send a response back to the sender." 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
|
Vibe coding it, like it's 2025! Well done. I've pushed rymdbar:pr/5044 which adds two, hand-crafted LLM-free, details:
One could imagine the user might be interesting in learning the names of unknown calls, so that might be a possible improvement. The test case kind of works, but is a bit of a hack. I assume there are better ways of doing it, but this is what I came up with. What worries me most is that merging this with my commit included might lead to users feeling flooded by messages caused by lsp:s ignoring announced capabilities and just yolo:ing calls. Please feel free updating the PR to include this test case. |
[snip]
What if we put this behind a setting (
[snip]
I think there are test cases that simulate server requests and check responses?
❤️ |
|
Hi ale team, I personally don't have time to add tests. But feel free to modify this PR or take the code to create a new PR. Cheers! |
|
I just tested this pull request after the recommendation from @rymdbar. This fixes #4998, #5058 and biomejs/biome#7908. Can we get this merged? |
benknoble
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a nit.
| call ale#util#GetFunction(l:Callback)(a:conn_id, l:response) | ||
| let l:result = ale#util#GetFunction(l:Callback)(a:conn_id, l:response) | ||
|
|
||
| if l:result is v:true | ||
| let l:handled = 1 | ||
| endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify: if ale#util…
My exact words were: You might wish to look at the conversation in that pull request and chip in your code to complete it? Looking at the pull request was only half of the instruction.
You mean in its current state? I think the mere fact that this pull request is open already answered that before the question was phrased. |
The Language Server Protocol requires that all requests receive responses. Previously, ALE would silently ignore unknown JSON-RPC requests from language servers (like workspace/configuration), violating the LSP specification.
Solution:
This ensures ALE is compliant with the LSP specification requirement that "Every processed request must send a response back to the sender."
🤖 Generated with Claude Code
Fixes #4610
I have not added vader test, due to insufficient AI training data. Yet I think this pull request is good enough for an inspiration.