elixir-lsp / vscode-elixir-ls

Elixir language support and debugger for VS Code, powered by ElixirLS.
https://marketplace.visualstudio.com/items?itemName=JakeBecker.elixir-ls
MIT License
545 stars 105 forks source link

Unable to connect to the language server #354

Closed westmark closed 1 year ago

westmark commented 1 year ago

The extension seems to be unable to connect to the language server. Starting the language server manually seems to work (see logs below). I could reproduce this in an empty project.

Environment

Troubleshooting

Crash report template

Extension output:

[Error - 09:25:56] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 09:25:56] Connection to server got closed. Server will restart.
true
[Error - 09:25:56] ElixirLS - core client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 09:25:56] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 09:25:56] Connection to server got closed. Server will restart.
true
[Error - 09:25:56] ElixirLS - core client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 09:25:58] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 09:25:58] Connection to server got closed. Server will restart.
true
[Error - 09:25:58] ElixirLS - core client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 09:25:58] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 09:25:58] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 09:25:58] Connection to server got closed. Server will restart.
true
[Error - 09:25:58] ElixirLS - core client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 09:25:58] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 09:25:58] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 09:25:58] The ElixirLS - core server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 09:25:58] ElixirLS - core client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 09:25:58] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 

Extension host output

2023-07-14 09:25:57.868 [error] Error: Pending response rejected since connection got disposed
    at Object.dispose (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-jsonrpc/lib/common/connection.js:1167:27)
    at Object.dispose (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-languageclient/lib/common/client.js:1514:35)
    at LanguageClient.handleConnectionClosed (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-languageclient/lib/common/client.js:1105:34)
    at LanguageClient.handleConnectionClosed (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-languageclient/lib/node/main.js:180:22)
    at closeHandler (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-languageclient/lib/common/client.js:1092:18)
    at CallbackList.invoke (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
    at Emitter.fire (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
    at closeHandler (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-jsonrpc/lib/common/connection.js:314:26)
    at CallbackList.invoke (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-jsonrpc/lib/common/events.js:55:39)
    at Emitter.fire (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-jsonrpc/lib/common/events.js:117:36)
    at StreamMessageWriter.fireClose (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-jsonrpc/lib/common/messageWriter.js:42:27)
    at Socket.<anonymous> (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-jsonrpc/lib/common/messageWriter.js:74:42)
    at Socket.emit (node:events:513:28)
    at Pipe.<anonymous> (node:net:757:14)
2023-07-14 09:25:57.868 [error] Error: Client is not running and can't be stopped. It's current state is: starting
    at LanguageClient.shutdown (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-languageclient/lib/common/client.js:914:19)
    at LanguageClient.stop (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-languageclient/lib/common/client.js:885:21)
    at LanguageClient.stop (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-languageclient/lib/node/main.js:150:22)
    at LanguageClient.doInitialize (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-languageclient/lib/common/client.js:867:27)
    at LanguageClient.start (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-languageclient/lib/common/client.js:722:13)
2023-07-14 09:25:58.018 [error] Error: Client is not running and can't be stopped. It's current state is: startFailed
    at LanguageClient.shutdown (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-languageclient/lib/common/client.js:914:19)
    at LanguageClient.stop (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-languageclient/lib/common/client.js:885:21)
    at LanguageClient.stop (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-languageclient/lib/node/main.js:150:22)
    at LanguageClient.doInitialize (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-languageclient/lib/common/client.js:867:27)
    at LanguageClient.start (/Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/node_modules/vscode-languageclient/lib/common/client.js:722:13)

Manually running the language server seems to work

07/14/23|09:18:02  elixir-ls-release  $ ./language_server.sh
Running /Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/launch.sh
Looking for ASDF install in /Users/westmark/.asdf/asdf.sh
Installing ElixirLS release v0.15.1
Running in /Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release
Install complete
Content-Length: 103

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Started ElixirLS v0.15.1","type":3}}Content-Length: 170

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Running in /Users/westmark/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release","type":3}}Content-Length: 130

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"ElixirLS built with elixir \"1.15.2\" on OTP \"26\"","type":3}}Content-Length: 151

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Running on elixir \"1.15.2 (compiled with Erlang/OTP 26)\" on OTP \"26\"","type":3}}Content-Length: 109

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Protocols are not consolidated","type":3}}Content-Length: 194

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Elixir sources not found (checking in /home/runner/work/elixir/elixir). Code navigation to Elixir modules disabled.","type":3}}Content-Length: 111

{"jsonrpc":"2.0","method":"window/logMessage","params":{"message":"Experimental server is disabled.","type":3}}
westmark commented 1 year ago

I'm an idiot. I had a local fork of the language server since way back that I had configured the extension to use. Had completely forgotten about it