-
Notifications
You must be signed in to change notification settings - Fork 0
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
Major bug: JSON RPC calls with a single primitive argument are broken in LSP4J #85
Comments
One alternative that may also be worth considering is to go back to |
I don't really like the Idea of going back to |
What makes you think that To get a little closer to what the "standard" way of using When we last discussed this, you brought up the argument that custom JSON RPC commands would allow us to better specify the return type for code completions. This was a valid argument at the time, but as it currently is, I suspect that most of our commands would just publish diagnostics and not need to return much at all. |
I'm not thinking it is incorrect I just feel like it is not correct:D Probably because using JsonRpc seems much cleaner. |
Today, I wanted to implement support for the custom JSON RPC calls understood by the Mo|E server so that you can test your implementation with the vscode client. However, regardless of how I sent the
loadModel
request from the vscode-plugin, the server would just not accept the request, reporting an error in the parsing stage of the JSON RPC implementation.After a whopping 4 hours of debugging, I found out that the error can be traced to an LSP4J issue regarding requests with a single parameter. According to the JSON RPC spec, parameters MUST always be wrapped either in an array or an object. LSP4J does not respect this and instead expects that
params
is a raw JSON string literal. With this behavior, it is virtually impossible to generate a request with the LSP implementation in vscode that would be accepted by the LSP4J server.Long story short, since the issue is known since May and there is no fix on the horizon, we have to completely restructure our custom JSON RPC calls. I have implemented a quick example in MopeSWTP-SS21/LSP4J-test-CS, which does work with the vscode client. I think the best way to circumvent this problem is to simply always use parameter objects, which also would make the Mo|E calls more consistent with the standard LSP calls in LSP4J.
The text was updated successfully, but these errors were encountered: