elixir-ls wont start over tramp
Thank you for the bug report
- [X] I am using the latest version of
lsp-moderelated packages. - [X] I checked FAQ and Troubleshooting sections
- [X] You may also try reproduce the issue using clean environment using the following command:
M-x lsp-start-plain
Bug description
When trying to use lsp mode with elxir locally it works without issue. trying to use it over tramp mode causes it to crash instantly on startup due to a json decoding bug, it looks like there is an off by one issue.
Steps to reproduce
install elixir-ls
(make-lsp-client :new-connection (lsp-tramp-connection "/path/to/elixir-ls")
:major-modes '(elixir-mode)
:remote? t
:server-id 'elixir-ls-remote))
open an elixir file over tramp
Expected behavior
that I could use lsp-mode over tramp with elixir files.
Which Language Server did you use?
elixir-ls
OS
Linux
Error callstack
[Trace - 08:27:35 AM] Sending request 'initialize - (6)'.
Params: {
"processId": null,
"rootPath": "/home/mog/abcde",
"clientInfo": {
"name": "emacs",
"version": "GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0)"
},
"rootUri": "file:///home/mog/abcde",
"capabilities": {
"workspace": {
"workspaceEdit": {
"documentChanges": true,
"resourceOperations": [
"create",
"rename",
"delete"
]
},
"applyEdit": true,
"symbol": {
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
}
},
"executeCommand": {
"dynamicRegistration": false
},
"didChangeWatchedFiles": {
"dynamicRegistration": true
},
"workspaceFolders": true,
"configuration": true,
"codeLens": {
"refreshSupport": true
},
"fileOperations": {
"didCreate": false,
"willCreate": false,
"didRename": true,
"willRename": true,
"didDelete": false,
"willDelete": false
}
},
"textDocument": {
"declaration": {
"linkSupport": true
},
"definition": {
"linkSupport": true
},
"implementation": {
"linkSupport": true
},
"typeDefinition": {
"linkSupport": true
},
"synchronization": {
"willSave": true,
"didSave": true,
"willSaveWaitUntil": true
},
"documentSymbol": {
"symbolKind": {
"valueSet": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
]
},
"hierarchicalDocumentSymbolSupport": true
},
"formatting": {
"dynamicRegistration": true
},
"rangeFormatting": {
"dynamicRegistration": true
},
"rename": {
"dynamicRegistration": true,
"prepareSupport": true
},
"codeAction": {
"dynamicRegistration": true,
"isPreferredSupport": true,
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"",
"quickfix",
"refactor",
"refactor.extract",
"refactor.inline",
"refactor.rewrite",
"source",
"source.organizeImports"
]
}
},
"resolveSupport": {
"properties": [
"edit",
"command"
]
},
"dataSupport": true
},
"completion": {
"completionItem": {
"snippetSupport": true,
"documentationFormat": [
"markdown",
"plaintext"
],
"resolveAdditionalTextEditsSupport": true,
"insertReplaceSupport": true,
"deprecatedSupport": true,
"resolveSupport": {
"properties": [
"documentation",
"detail",
"additionalTextEdits",
"command"
]
},
"insertTextModeSupport": {
"valueSet": [
1,
2
]
}
},
"contextSupport": true
},
"signatureHelp": {
"signatureInformation": {
"parameterInformation": {
"labelOffsetSupport": true
}
}
},
"documentLink": {
"dynamicRegistration": true,
"tooltipSupport": true
},
"hover": {
"contentFormat": [
"markdown",
"plaintext"
]
},
"callHierarchy": {
"dynamicRegistration": false
},
"publishDiagnostics": {
"relatedInformation": true,
"tagSupport": {
"valueSet": [
1,
2
]
},
"versionSupport": true
},
"linkedEditingRange": {
"dynamicRegistration": true
}
},
"window": {
"workDoneProgress": true,
"showMessage": null,
"showDocument": {
"support": true
}
}
},
"initializationOptions": null,
"workDoneToken": "1"
}
[Trace - 08:27:37 AM] Received notification 'window/logMessage'.
Params: {
"message": "Started ElixirLS v0.10.0",
"type": 4
}
[Trace - 08:27:37 AM] Received notification 'window/logMessage'.
Params: {
"message": "Elixir version: \"1.13.4 (compiled with Erlang/OTP 24)\"",
"type": 4
}
[Trace - 08:27:37 AM] Received notification 'window/logMessage'.
Params: {
"message": "Erlang version: \"24\"",
"type": 4
}
[Trace - 08:27:37 AM] Received notification 'window/logMessage'.
Params: {
"message": "ElixirLS compiled with Elixir 1.13.4 and erlang 24",
"type": 4
}
[Trace - 08:27:37 AM] Received notification 'window/logMessage'.
Params: {
"message": "warning: Unable to read from device: %JasonVendored.DecodeError{data: \"\\n\\n{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"method\\\":\\\"initialize\\\",\\\"params\\\":{\\\"processId\\\":null,\\\"rootPath\\\":\\\"/home/mog/abcde\\\",\\\"clientInfo\\\":{\\\"name\\\":\\\"emacs\\\",\\\"version\\\":\\\"GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0)\\\"},\\\"rootUri\\\":\\\"file:///home/mog/abcde\\\",\\\"capabilities\\\":{\\\"workspace\\\":{\\\"workspaceEdit\\\":{\\\"documentChanges\\\":true,\\\"resourceOperations\\\":[\\\"create\\\",\\\"rename\\\",\\\"delete\\\"]},\\\"applyEdit\\\":true,\\\"symbol\\\":{\\\"symbolKind\\\":{\\\"valueSet\\\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},\\\"executeCommand\\\":{\\\"dynamicRegistration\\\":false},\\\"didChangeWatchedFiles\\\":{\\\"dynamicRegistration\\\":true},\\\"workspaceFolders\\\":true,\\\"configuration\\\":true,\\\"codeLens\\\":{\\\"refreshSupport\\\":true},\\\"fileOperations\\\":{\\\"didCreate\\\":false,\\\"willCreate\\\":false,\\\"didRename\\\":true,\\\"willRename\\\":true,\\\"didDelete\\\":false,\\\"willDelete\\\":false}},\\\"textDocument\\\":{\\\"declaration\\\":{\\\"linkSupport\\\":true},\\\"definition\\\":{\\\"linkSupport\\\":true},\\\"implementation\\\":{\\\"linkSupport\\\":true},\\\"typeDefinition\\\":{\\\"linkSupport\\\":true},\\\"synchronization\\\":{\\\"willSave\\\":true,\\\"didSave\\\":true,\\\"willSaveWaitUntil\\\":true},\\\"documentSymbol\\\":{\\\"symbolKind\\\":{\\\"valueSet\\\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},\\\"hierarchicalDocumentSymbolSupport\\\":true},\\\"formatting\\\":{\\\"dynamicRegistration\\\":true},\\\"rangeFormatting\\\":{\\\"dynamicRegistration\\\":true},\\\"rename\\\":{\\\"dynamicRegistration\\\":true,\\\"prepareSupport\\\":true},\\\"codeAction\\\":{\\\"dynamicRegistration\\\":true,\\\"isPreferredSupport\\\":true,\\\"codeActionLiteralSupport\\\":{\\\"codeActionKind\\\":{\\\"valueSet\\\":[\\\"\\\",\\\"quickfix\\\",\\\"refactor\\\",\\\"refactor.extract\\\",\\\"refactor.inline\\\",\\\"refactor.rewrite\\\",\\\"source\\\",\\\"source.organizeImports\\\"]}},\\\"resolveSupport\\\":{\\\"properties\\\":[\\\"edit\\\",\\\"command\\\"]},\\\"dataSupport\\\":true},\\\"completion\\\":{\\\"completionItem\\\":{\\\"snippetSupport\\\":true,\\\"documentationFormat\\\":[\\\"markdown\\\",\\\"plaintext\\\"],\\\"resolveAdditionalTextEditsSupport\\\":true,\\\"insertReplaceSupport\\\":true,\\\"deprecatedSupport\\\":true,\\\"resolveSupport\\\":{\\\"properties\\\":[\\\"documentation\\\",\\\"detail\\\",\\\"additionalTextEdits\\\",\\\"command\\\"]},\\\"insertTextModeSupport\\\":{\\\"valueSet\\\":[1,2]}},\\\"contextSupport\\\":true},\\\"signatureHelp\\\":{\\\"signatureInformation\\\":{\\\"parameterInformation\\\":{\\\"labelOffsetSupport\\\":true}}},\\\"documentLink\\\":{\\\"dynamicRegistration\\\":true,\\\"tooltipSupport\\\":true},\\\"hover\\\":{\\\"contentFormat\\\":[\\\"markdown\\\",\\\"plaintext\\\"]},\\\"callHierarchy\\\":{\\\"dynamicRegistration\\\":false},\\\"publishDiagnostics\\\":{\\\"relatedInformation\\\":true,\\\"tagSupport\\\":{\\\"valueSet\\\":[1,2]},\\\"versionSupport\\\":true},\\\"linkedEditingRange\\\":{\\\"dynamicRegistration\\\":true}},\\\"window\\\":{\\\"workDoneProgress\\\":true,\\\"showMessage\\\":null,\\\"showDocument\\\":{\\\"support\\\":true}}},\\\"initializationOptions\\\":null,\\\"workDoneToken\\\":\\\"1\\\"},\\\"id\\\":6\", position: 2585, token: nil}\n (elixir 1.13.4) lib/stream.ex:1525: Stream.do_resource/5\n (elixir 1.13.4) lib/stream.ex:1719: Enumerable.Stream.do_each/4\n (elixir 1.13.4) lib/stream.ex:649: Stream.run/1\n (stdlib 3.17) erl_eval.erl:685: :erl_eval.do_apply/6\n (elixir 1.13.4) src/elixir.erl:296: :elixir.recur_eval/3\n (elixir 1.13.4) src/elixir.erl:274: :elixir.eval_forms/3\n",
"type": 2
}
Anything else?
I am not sure where the problem is so I also opened issue here https://github.com/elixir-lsp/elixir-ls/issues/714
according to elixir-ls people emacs is sending a double new line at the beginning which is not within spec.
I thought lsp-mode with tramp is pretty much broken anyway? So maybe that contributes to the issue you are facing
I haven't been able to get lsp-mode working consistently using rust-analyzer and have seen a handful of other open issues about the same thing, so I'd also guess it has to do with lsp-mode / tramp instead of a specific language server.
Is that the consensus @yyoncho ? Is there a fix in the works?
I was able to get it working filtering out the first new line, but had additional problems as my direnv wasnt being respected.