Replies: 57 comments
-
does vscode now have websocket support for language servers or did you come up with something custom? (in both cases do both send the same message format at monaco language client / ws jsonrpc does (e.g. regarding headers) here is a trace when using monaco
so any of these might be a good canidate |
Beta Was this translation helpful? Give feedback.
-
I think they have but I'm connecting to Language Server which is not managed by VS Code. So the Language Server is launched outside of VS Code. The client part of VS Code is just connecting to this Language Server implementation. Thanks for the trace! |
Beta Was this translation helpful? Give feedback.
-
so how does the client in your vscode plugin look like? |
Beta Was this translation helpful? Give feedback.
-
the important part is:
EDIT: here is full branch of the client https://github.com/apupier/vscode-datavirt/tree/testLSPWebsocket-githubreference |
Beta Was this translation helpful? Give feedback.
-
i am not sure if this will send the messages the websocket on server expects or if it will sent the header as well which then will break the json parsing see e.g. #189 |
Beta Was this translation helpful? Give feedback.
-
interesting link. By following linke dissues, i came on one of your comment
My Language Server is using LSP4J 0.8.1 so I would expect that it is not hitting the issue. Or I misunderstood a part? And I still need to provide a specific implementation for MessageProducer/Consumer either on VS Code side or on Server side? |
Beta Was this translation helpful? Give feedback.
-
no. the monaco language client does not send json rpc with header but the payload json only. |
Beta Was this translation helpful? Give feedback.
-
I think that th eproblem is that VS COde is sending in Binary format although LSP4J does not provide a BinaryHandler: here is the stack that let me think that:
it is throwing the IllegalStateException in this piece of code:
|
Beta Was this translation helpful? Give feedback.
-
so, this can be workarounded on client side by configuring it to use text format, for TypeScript, when using ws library, this can be done using
unfortunately it is still not working. The lsp4j MessageJSOnHandler is unable to read the incoming content:
|
Beta Was this translation helpful? Give feedback.
-
and what is in the message? |
Beta Was this translation helpful? Give feedback.
-
the content of the message is:
strange |
Beta Was this translation helpful? Give feedback.
-
as i have said and is mentioned in that other issue: am not sure how https://github.com/TypeFox/vscode-ws-jsonrpc will behave |
Beta Was this translation helpful? Give feedback.
-
asked on StaskOverflow how to avoid "CONTENT-LENGTH" with a Websocket connection: https://stackoverflow.com/questions/60372566/how-to-configure-websocket-to-not-send-content-length-in-javascript-typescript |
Beta Was this translation helpful? Give feedback.
-
Just to chime in, we've been having the same issue once in a while as well. In our case, it happens in plain java JUnit tests so VS Code is not even in the loop. What we've seen is that the jsonRPC message is sometimes jumbled up for unknown reasons. This message can then of course not be interpreted by LSP4J. An example is shown below. As you can see somehow the Content-Length is sent separately as well as at the end of the initialize message ( Do note that this is for LSP4J <= 0.12.0
|
Beta Was this translation helpful? Give feedback.
-
Sorry to resurrect this old issue but I have exact same problem. My LSP4J version is 0.21.0 and I cannot get it to work with VSCode LSP client. Wondering if anyone can give me any pointers on how to troubleshoot. Many thanks! E. |
Beta Was this translation helpful? Give feedback.
-
i assume you have to copy & paste subclass the class that calls the constructor. org.eclipse.lsp4j.websocket.WebSocketMessageHandler.WebSocketMessageHandler(MessageConsumer, MessageJsonHandler, MessageIssueHandler) but no more. |
Beta Was this translation helpful? Give feedback.
-
See my sample code above, it's Jetty. |
Beta Was this translation helpful? Give feedback.
-
i am still see |
Beta Was this translation helpful? Give feedback.
-
Well, I tried to set decodeStrings to true in the client: |
Beta Was this translation helpful? Give feedback.
-
which jsonHandler? |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
i dont see this called at all. wonder how you setup jetty |
Beta Was this translation helpful? Give feedback.
-
Nothing special about my jetty setup, I posted the code above: #406 (comment) |
Beta Was this translation helpful? Give feedback.
-
Well, I tried everything I could and now I'm kinda stuck. I was able to successfully connect Monaco client to my LSP4J implementation, but not VSCode extension. |
Beta Was this translation helpful? Give feedback.
-
Is there a reason / usecase you need to connect via web socket / process io or normal socket not an option |
Beta Was this translation helpful? Give feedback.
-
Actually, no, normal socket would also be an option, but I'm not sure I know how to implement this in VSCode. |
Beta Was this translation helpful? Give feedback.
-
Yep, thanks, with plain socket it works now. I will still need to solve the websocket problem though, but I can save this for later. |
Beta Was this translation helpful? Give feedback.
-
Maybe also talk to vscode language client Team to introduce an option to configure if array is sent or plain text |
Beta Was this translation helpful? Give feedback.
-
This subclass solution fixed the JSON-RPC header issue for me, but the backend LS I was using is implemented with pygls. |
Beta Was this translation helpful? Give feedback.
-
Currently trying to connect a VS Code Client to a Language Server written on LSP4J 0.8.1.
The "connect" method is called and it throws no error (when address is wrong, I have other errors)
The client is sending an initialize request:
But the implementation method LanguageServer.initialize(InitializeParams) is not called.
I tried to put breakpoint on org.eclipse.lsp4j.websocket.WebSocketMessageConsumer.consume(Message) and org.eclipse.lsp4j.websocket.WebSocketMessageHandler.onMessage(String) but these methods are not called either.
What is the best place to trace the request on Server side? so that i can see the path that it follows and see where the request is blocked/rejected/lost.
Please note that i was able to make it working with another client, Monaco.
Beta Was this translation helpful? Give feedback.
All reactions