Skip to content
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

Connecting monaco with Yang language server #160

Closed
OmReddy opened this issue Jul 16, 2019 · 6 comments
Closed

Connecting monaco with Yang language server #160

OmReddy opened this issue Jul 16, 2019 · 6 comments
Labels

Comments

@OmReddy
Copy link

OmReddy commented Jul 16, 2019

Hi,

I am having trouble to use this in my example. I am trying to connect to Yang language server (via web socket based) . I just modified few things to connect to Yang-LSP.

In client.js harcoding my yang-lsp server
function createUrl(path: string): string {
const protocol = location.protocol === 'https:' ? 'wss' : 'ws';
return normalizeUrl(${protocol}://localhost:5007);
}

languageclient does try to connect to my language server. However, the language server throwing below error...

`java.lang.IllegalStateException: Missing header Content-Length in input "GET / HTTP/1.1
Host: localhost:5007
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Origin: http://localhost:3000
Sec-WebSocket-Version: 13
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Sec-WebSocket-Key: 0ssCC+n3Mw6RpB2c+3COYw==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits

"
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:91)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:99)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)`

its asking for Content-Length
I have already gone through the whole discussion around HTTP and LSP protocol and stuff
I didn't find any fix or workaround mentioned any where.

Does it require some intermediate parser logic from yang file to stream?
Any help/guidance will be appreciated

Thank you
Om Reddy

@rcjsuen
Copy link
Contributor

rcjsuen commented Jul 16, 2019

@OmReddy Have you tried connecting with other language servers? Do those work?

@OmReddy
Copy link
Author

OmReddy commented Jul 17, 2019

@rcjsuen the examples given with the Monaco language server are working for me
languageClient. Both examples are on JSON server.
I did my changes in json-server-launcher. So instead of JSON i am starting my Yang LSP here.
It appears everything is hooked, but when i try to send request(by modifying something in monaco editor) getting above error on server side.

@rcjsuen
Copy link
Contributor

rcjsuen commented Jul 17, 2019

Perhaps you could try launching the YANG language server from the command line and sending things directly in from there or try connecting to it with a different language client? Or maybe not use web sockets?

The VS Code extension for YANG doesn't seem very complicated so it seems like it shouldn't be hard to start the server.

@OmReddy
Copy link
Author

OmReddy commented Jul 19, 2019

@cdietrich @tocjent
Hi Folks, sorry to bother you guys... i read the discussion you guys had on similar issue few months back 189
Can you suggest what is the work around for this

@cdietrich
Copy link
Contributor

either you can add/trim the header on the server.
or you use the upcoming lsp 0.8.0-SNAPSHOT which has support for websockets directly by avoiding using StreamMessageProducer/Consumer

eclipse-lsp4j/lsp4j#314

@stale
Copy link

stale bot commented Sep 21, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants