voldikss / coc-lsp-wl

See https://github.com/voldikss/coc-extensions
7 stars 0 forks source link

Connection to server got closed. Server will restart. #4

Closed oblitum closed 5 years ago

oblitum commented 5 years ago

Hi, I'm on Linux and I'm trying coc-lsp-wl but I'm only getting "Connection to server got closed. Server will restart." in :CocInfo.

Output: https://gist.github.com/oblitum/4e8489a0205ec49650046a005c9f9c7f

I also often get the following on subsequent :CocInfo

## Output channel: lsp-wl

[Error  - 5:41:20 PM] Connection to server is erroring. Shutting down server.
[Trace - 5:41:20 PM] Sending request 'shutdown - (1)'.
[Error  - 5:41:20 PM] Connection to server is erroring. Shutting down server.
[Error  - 5:41:20 PM] Connection to server is erroring. Shutting down server.
[Error  - 5:41:20 PM] Connection to server is erroring. Shutting down server.
[Error  - 5:41:20 PM] Connection to server is erroring. Shutting down server.
oblitum commented 5 years ago

I've initially reported it to the server project but I think it may be worth checking here first.

voldikss commented 5 years ago

What's your configuration of this extension in coc-settings.json?

oblitum commented 5 years ago

I don't do my configuration in coc-settings.json, I do it from .vimrc on VimEnter like the following:

  call coc#config('lsp-wl', {
  \   'wolframLanguageServerPath': '/home/francisco/Projects/lsp-wl'
  \ })
oblitum commented 5 years ago

mathematica is 11.2.0.

voldikss commented 5 years ago

Hmmm, Have you tried running the server out of Vim?

According to the doc of lsp-wl here

wolfram -script /path/to/lsp-wl/init.wls [args]
# or
wolframscript -f /path/to/lsp-wl/init.wls [args]
voldikss commented 5 years ago

Or maybe the port was not opened?

oblitum commented 5 years ago

For testing from command line I had to do this on one terminal:

~ ❯❯❯ wolfram -script Projects/lsp-wl/init.wls --tcp-server
[INFO  2019-07-30T01:31:44] Initializing Wolfram Language Server
[INFO  2019-07-30T01:31:45] Language server is connecting the client through
tcp-server.
[INFO  2019-07-30T01:31:45] Server listening on port 6536...

And this on another:

~ ❯❯❯ wolfram -script Projects/lsp-wl/init.wls
[INFO  2019-07-30T01:31:53] Language server is connecting the client through
socket.
[INFO  2019-07-30T01:31:53] Server listening from port 6536...

Then the first terminal shows

[INFO  2019-07-30T01:31:53] Client connected

So, it seems to be working. Simply calling wolfram -script Projects/lsp-wl/init.wls alone doesn't work, I get an error:

~ ❯❯❯ wolfram -script Projects/lsp-wl/init.wls
[INFO  2019-07-30T01:31:28] Initializing Wolfram Language Server
[INFO  2019-07-30T01:31:28] Language server is connecting the client through
socket.

SocketConnect::zmqexception:
   A ZeroMQLink exception was thrown - Connection refused (code 111)
[ERROR 2019-07-30T01:31:28] Cannot connect to client via socket.

Which simply seems like a client missing a server.


As for opening ports, I didn't open any port on my firewall because I thought only loopback access was needed, so no need to open ports, and given that the above terminal interaction seemed to work and on :CocInfo I've posted first I also got this:

[INFO  2019-07-29T17:36:02] Server listening from port 6536...
[Trace - 5:36:03 PM] Received response 'initialize - (0)' in 427ms.
Result: {
    "capabilities": {
        "textDocumentSync": 2,
        "hoverProvider": true,
        "completionProvider": {
            "resolveProvider": true,
            "triggerCharacters": "\\"
        },
        "documentSymbolProvider": true
    }

It looked like coc got a first response, but then the server closes when a textDocument/didOpen is sent.

voldikss commented 5 years ago

Hmmmm sorry I actually doesn't know lsp too much. This extension was ported from vscode-lsp-wl but I don't know much more detail about the mechanism.

oblitum commented 5 years ago

Hmm, ok then :-/

kenkangxgwe commented 5 years ago

Simply calling wolfram -script Projects/lsp-wl/init.wls alone doesn't work, I get an error:

When you pass no extra arguments into the server, it will run as a socket client and try to connect to a socket server at the default port (6536). In your case, the connection will be refused. If you want to run it as a socket server, you should pass the --tcp-server=<port> argument.

kenkangxgwe commented 5 years ago

@voldikss, I confirm that it is an upstream problem. You can close the issue now.