lsp-mode
lsp-mode copied to clipboard
languageserver for R shutdowns over TRAMP
Thank you for the bug report
- [X] I am using the latest version of
lsp-mode
related 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 I tried to connect to an R file over TRAMP the lsp-server shutdowns and I get this error in the
stderr` buffer
Process lsp-r-remote stderr finished
[2022-06-15 11:02:08.437] Error: cannot change working directory
Call: setwd(wd)
Stack trace:
1: setwd(wd)
2: with_wd(rootPath, file.exists(str_texts) & !dir.exists(str_texts))
3: document_link_reply(id, uri, self$workspace, document, rootPath)
4: handler(self, item$id, item$params)
5: parse_callback(self, uri, version, result)
6: private$callback(result)
7: task$check()
8: self$parse_task_manager$check_tasks()
9: self$process_events()
[2022-06-15 11:02:08.448] exiting
Process lsp-r-remote stderr finished
In the lsp-log
buffer I could catch this error
[Trace - 11:09:13 AM] Received response 'textDocument/documentLink - (4803)' in 82ms.
Result: {
"code": -32603,
"message": "Error: cannot change working directory\nCall: setwd(wd)\nStack trace:\n1: setwd(wd)\n2: with_wd(rootPath, file.exists(str_texts) & !dir.exists(str_texts))\n3: document_link_reply(id, uri, self$workspace, document, rootPath)\n4: dispatch(self, id, params)\n"
}
In doom I have this config
(after! lsp-mode
(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection '("R" "--slave" "-e" "languageserver::run()"))
:major-modes '(ess-r-mode inferior-ess-r-mode)
:remote? t
:server-id 'lsp-r-remote)))
Steps to reproduce
- Open any file over TRAMP.
- The server shutdowns and appears this message
Expected behavior
Just the server working as usual
Which Language Server did you use?
The languageserver for R (https://github.com/REditorSupport/languageserver)
OS
MacOS
Error callstack
[Trace - 11:31:05 AM] Sending request 'initialize - (37)'.
Params: {
"processId": null,
"rootPath": "/home/msolis/my_project",
"clientInfo": {
"name": "emacs",
"version": "GNU Emacs 28.1 (build 1, x86_64-apple-darwin20.6.0, Carbon Version 164 AppKit 2022.7)\n of 2022-06-14"
},
"rootUri": "file:///home/msolis/my_project",
"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": false,
"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"
]
},
"foldingRange": null,
"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 - 11:31:06 AM] Received response 'initialize - (37)' in 478ms.
Result: {
"capabilities": {
"textDocumentSync": {
"openClose": true,
"change": 1,
"willSave": null,
"willSaveWaitUntil": null,
"save": {
"includeText": true
}
},
"hoverProvider": true,
"completionProvider": {
"resolveProvider": true,
"triggerCharacters": [
".",
":"
]
},
"signatureHelpProvider": {
"triggerCharacters": [
"(",
","
]
},
"definitionProvider": true,
"referencesProvider": true,
"documentHighlightProvider": true,
"documentSymbolProvider": true,
"workspaceSymbolProvider": true,
"codeActionProvider": true,
"documentFormattingProvider": true,
"documentRangeFormattingProvider": true,
"documentOnTypeFormattingProvider": {
"firstTriggerCharacter": "\n",
"moreTriggerCharacter": [
")",
"]",
"}"
]
},
"renameProvider": {
"prepareProvider": true
},
"documentLinkProvider": {
"resolveProvider": true
},
"colorProvider": true,
"foldingRangeProvider": true,
"selectionRangeProvider": true,
"callHierarchyProvider": true
}
}
[Trace - 11:31:06 AM] Sending notification 'initialized'.
Params: {}
[Trace - 11:31:06 AM] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/my_project/my_file.R",
"languageId": "r",
"version": 0,
"text": "some text"
}
}
[Trace - 11:31:06 AM] Sending request 'textDocument/documentSymbol - (38)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/my_project/my_file.R"
}
}
[Trace - 11:31:06 AM] Sending request 'textDocument/codeAction - (39)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/my_project/my_file.R"
},
"range": {
"start": {
"line": 21,
"character": 29
},
"end": {
"line": 21,
"character": 29
}
},
"context": {
"diagnostics": []
}
}
[Trace - 11:31:06 AM] Sending request 'textDocument/documentLink - (40)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/my_project/my_file.R"
}
}
[Trace - 11:31:06 AM] Sending request 'textDocument/documentHighlight - (41)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/my_project/my_file.R"
},
"position": {
"line": 21,
"character": 29
}
}
[Trace - 11:31:06 AM] Sending notification '$/cancelRequest'.
Params: {
"id": 39
}
[Trace - 11:31:06 AM] Sending request 'textDocument/codeAction - (42)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/my_project/my_file.R"
},
"range": {
"start": {
"line": 21,
"character": 29
},
"end": {
"line": 21,
"character": 29
}
},
"context": {
"diagnostics": []
}
}
[Trace - 11:31:06 AM] Sending request 'textDocument/documentLink - (43)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/my_project/my_file.R"
}
}
[Trace - 11:31:06 AM] Sending notification '$/cancelRequest'.
Params: {
"id": 41
}
[Trace - 11:31:06 AM] Sending request 'textDocument/documentHighlight - (44)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/my_project/my_file.R"
},
"position": {
"line": 21,
"character": 29
}
}
[Trace - 11:31:07 AM] Received response 'nil - (39)' in 0ms.
Result: []
[Trace - 11:31:07 AM] Received response 'nil - (41)' in 0ms.
Result: null
[Trace - 11:31:07 AM] Received response 'textDocument/codeAction - (42)' in 516ms.
Result: []
[Trace - 11:31:07 AM] Received response 'textDocument/documentHighlight - (44)' in 616ms.
Result: null
[Trace - 11:31:07 AM] Received response 'textDocument/documentSymbol - (38)' in 825ms.
Result: []
[Trace - 11:31:08 AM] Sending notification '$/cancelRequest'.
Params: {
"id": 43
}
[Trace - 11:31:08 AM] Sending notification '$/cancelRequest'.
Params: {
"id": 40
}
Anything else?
lsp-mode
works fine on local files. The problem is over TRAMP.
The same error triggers when the file only has this line paste("x", 1:10)
[Trace - 05:01:14 AM] Sending request 'textDocument/hover - (12)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/Proyectos/vignettes/test.R"
},
"position": {
"line": 0,
"character": 15
}
}
[Trace - 05:01:14 AM] Sending request 'textDocument/codeAction - (13)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/Proyectos/vignettes/test.R"
},
"range": {
"start": {
"line": 0,
"character": 15
},
"end": {
"line": 0,
"character": 15
}
},
"context": {
"diagnostics": []
}
}
[Trace - 05:01:14 AM] Sending request 'textDocument/documentLink - (14)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/Proyectos/vignettes/test.R"
}
}
[Trace - 05:01:14 AM] Sending request 'textDocument/documentHighlight - (15)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/Proyectos/vignettes/test.R"
},
"position": {
"line": 0,
"character": 15
}
}
[Trace - 05:01:14 AM] Received response 'textDocument/hover - (12)' in 161ms.
Result: null
[Trace - 05:01:14 AM] Received response 'textDocument/codeAction - (13)' in 191ms.
Result: []
[Trace - 05:01:14 AM] Received response 'textDocument/documentLink - (14)' in 234ms.
Result: {
"code": -32603,
"message": "Error: cannot change working directory\nCall: setwd(wd)\nStack trace:\n1: setwd(wd)\n2: with_wd(rootPath, file.exists(str_texts) & !dir.exists(str_texts))\n3: document_link_reply(id, uri, self$workspace, document, rootPath)\n4: dispatch(self, id, params)\n"
}
[Trace - 05:01:14 AM] Received response 'textDocument/documentHighlight - (15)' in 286ms.
Result: [
{
"range": {
"start": {
"line": 0,
"character": 13
},
"end": {
"line": 0,
"character": 15
}
},
"kind": 1
}
]
[Trace - 05:01:16 AM] Sending notification 'textDocument/didClose'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/Proyectos/vignettes/test.R"
}
}
[Trace - 05:01:16 AM] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/Proyectos/vignettes/test.R",
"languageId": "r",
"version": 1,
"text": "paste(\"x\", 1:10)\n"
}
}
[Trace - 05:01:16 AM] Sending request 'textDocument/documentSymbol - (16)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/Proyectos/vignettes/test.R"
}
}
[Trace - 05:01:16 AM] Sending request 'textDocument/codeAction - (17)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/Proyectos/vignettes/test.R"
},
"range": {
"start": {
"line": 0,
"character": 15
},
"end": {
"line": 0,
"character": 15
}
},
"context": {
"diagnostics": []
}
}
[Trace - 05:01:16 AM] Sending request 'textDocument/documentLink - (18)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/Proyectos/vignettes/test.R"
}
}
[Trace - 05:01:16 AM] Sending request 'textDocument/documentHighlight - (19)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/Proyectos/vignettes/test.R"
},
"position": {
"line": 0,
"character": 15
}
}
[Trace - 05:01:16 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///home/msolis/Proyectos/vignettes/test.R",
"version": null,
"diagnostics": []
}
[Trace - 05:01:16 AM] Received response 'textDocument/codeAction - (17)' in 59ms.
Result: []
[Trace - 05:01:16 AM] Received response 'textDocument/documentSymbol - (16)' in 135ms.
Result: []
[Trace - 05:01:16 AM] Sending request 'textDocument/codeAction - (20)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/Proyectos/vignettes/test.R"
},
"range": {
"start": {
"line": 0,
"character": 15
},
"end": {
"line": 0,
"character": 15
}
},
"context": {
"diagnostics": []
}
}
[Trace - 05:01:16 AM] Sending request 'textDocument/documentLink - (21)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/Proyectos/vignettes/test.R"
}
}
[Trace - 05:01:16 AM] Sending notification '$/cancelRequest'.
Params: {
"id": 19
}
[Trace - 05:01:16 AM] Sending request 'textDocument/documentHighlight - (22)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/Proyectos/vignettes/test.R"
},
"position": {
"line": 0,
"character": 15
}
}
[Trace - 05:01:16 AM] Sending request 'textDocument/hover - (23)'.
Params: {
"textDocument": {
"uri": "file:///home/msolis/Proyectos/vignettes/test.R"
},
"position": {
"line": 0,
"character": 15
}
}
[Trace - 05:01:17 AM] Sending notification '$/cancelRequest'.
Params: {
"id": 21
}
[Trace - 05:01:17 AM] Sending notification '$/cancelRequest'.
Params: {
"id": 20
}
[Trace - 05:01:17 AM] Sending notification '$/cancelRequest'.
Params: {
"id": 18
}
Hi guys!
Just a little update. I tried eglot over TRAMP and everything works fine.
This is the events' log.
[stderr] nil
[stderr]
[stderr] Last login: Thu Sep 22 05:46:31 2022 from 10.253.4.157
[stderr] nil
[stderr] nil
[stderr]
[stderr] nil
[stderr]
[stderr] tramp_exit_status 0
[stderr] tramp_exit_status 0
[stderr] tramp_exit_status 0
[stderr]
[stderr] nil
[stderr]
[stderr] nil
[stderr]
[stderr] foo
[stderr] foo
[stderr] foo
[stderr]
[stderr] nil
[stderr]
[stderr] foo
[stderr] bar
[stderr] bar
[stderr] bar
[stderr]
[stderr] nil
[stderr]
[stderr] nil
[stderr]
[stderr] nil
[stderr]
[stderr] nil
[stderr]
[stderr] "/dev/pts/2"
[stderr] tramp_exit_status 0
[stderr] tramp_exit_status 0
[stderr] tramp_exit_status 0
[stderr] "/dev/pts/2"
[stderr]
[stderr] nil
[stderr]
[stderr] nil
[stderr]
[stderr] 18139
[stderr] tramp_exit_status 0
[stderr] tramp_exit_status 0
[stderr] tramp_exit_status 0
[stderr] 18139
[stderr]
[internal] Thu Sep 22 05:47:50 2022:
(:message "Running language server: sh -c stty raw > /dev/null; R --slave -e languageserver\\:\\:run\\(\\)")
[client-request] (id:1) Thu Sep 22 05:47:50 2022:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
(:processId nil :rootPath "/home/msolis/Proyectos/vignettes/" :rootUri "file:///home/msolis/Proyectos/vignettes" :initializationOptions #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
())
:capabilities
(:workspace
(:applyEdit t :executeCommand
(:dynamicRegistration :json-false)
:workspaceEdit
(:documentChanges t)
:didChangeWatchedFiles
(:dynamicRegistration :json-false)
:symbol
(:dynamicRegistration :json-false)
:configuration t :workspaceFolders t)
:textDocument
(:synchronization
(:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
:completion
(:dynamicRegistration :json-false :completionItem
(:snippetSupport :json-false :deprecatedSupport t :tagSupport
(:valueSet
[1]))
:contextSupport t)
:hover
(:dynamicRegistration :json-false :contentFormat
["markdown" "plaintext"])
:signatureHelp
(:dynamicRegistration :json-false :signatureInformation
(:parameterInformation
(:labelOffsetSupport t)
:activeParameterSupport t))
:references
(:dynamicRegistration :json-false)
:definition
(:dynamicRegistration :json-false :linkSupport t)
:declaration
(:dynamicRegistration :json-false :linkSupport t)
:implementation
(:dynamicRegistration :json-false :linkSupport t)
:typeDefinition
(:dynamicRegistration :json-false :linkSupport t)
:documentSymbol
(:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t :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]))
:documentHighlight
(:dynamicRegistration :json-false)
:codeAction
(:dynamicRegistration :json-false :codeActionLiteralSupport
(:codeActionKind
(:valueSet
["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" "source" "source.organizeImports"]))
:isPreferredSupport t)
:formatting
(:dynamicRegistration :json-false)
:rangeFormatting
(:dynamicRegistration :json-false)
:rename
(:dynamicRegistration :json-false)
:publishDiagnostics
(:relatedInformation :json-false :codeDescriptionSupport :json-false :tagSupport
(:valueSet
[1 2])))
:experimental #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
()))
:workspaceFolders
[(:uri "file:///home/msolis/Proyectos/vignettes" :name "/ssh:my.ssh.server:/home/msolis/Proyectos/vignettes/")]))
[server-reply] (id:1) Thu Sep 22 05:47:51 2022:
(:jsonrpc "2.0" :id 1 :result
(:capabilities
(:textDocumentSync
(:openClose t :change 1 :willSave :json-false :willSaveWaitUntil :json-false :save
(:includeText t))
:hoverProvider t :completionProvider
(:resolveProvider t :triggerCharacters
["." ":"])
:signatureHelpProvider
(:triggerCharacters
["(" ","])
:definitionProvider t :referencesProvider t :documentHighlightProvider t :documentSymbolProvider t :workspaceSymbolProvider t :codeActionProvider t :documentFormattingProvider t :documentRangeFormattingProvider t :documentOnTypeFormattingProvider
(:firstTriggerCharacter "\n" :moreTriggerCharacter
[")" "]" "}"])
:renameProvider t :documentLinkProvider
(:resolveProvider t)
:colorProvider t :foldingRangeProvider t :selectionRangeProvider t :callHierarchyProvider t)))
[client-notification] Thu Sep 22 05:47:51 2022:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
()))
[client-notification] Thu Sep 22 05:47:51 2022:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
(:textDocument
(:uri "file:///home/msolis/Proyectos/vignettes/test.R" :version 0 :languageId "ess-r" :text "paste(\"x\", 1:10)\n")))
[client-notification] Thu Sep 22 05:47:51 2022:
(:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params
(:settings #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
())))
[client-request] (id:2) Thu Sep 22 05:47:52 2022:
(:jsonrpc "2.0" :id 2 :method "textDocument/signatureHelp" :params
(:textDocument
(:uri "file:///home/msolis/Proyectos/vignettes/test.R")
:position
(:line 1 :character 0)))
[client-request] (id:3) Thu Sep 22 05:47:52 2022:
(:jsonrpc "2.0" :id 3 :method "textDocument/hover" :params
(:textDocument
(:uri "file:///home/msolis/Proyectos/vignettes/test.R")
:position
(:line 1 :character 0)))
[client-request] (id:4) Thu Sep 22 05:47:52 2022:
(:jsonrpc "2.0" :id 4 :method "textDocument/documentHighlight" :params
(:textDocument
(:uri "file:///home/msolis/Proyectos/vignettes/test.R")
:position
(:line 1 :character 0)))
[server-reply] (id:2) Thu Sep 22 05:47:52 2022:
(:jsonrpc "2.0" :id 2 :result
(:signatures
[]
:activeSignature -1))
[server-reply] (id:3) Thu Sep 22 05:47:52 2022:
(:jsonrpc "2.0" :id 3 :result nil)
[server-reply] (id:4) Thu Sep 22 05:47:52 2022:
(:jsonrpc "2.0" :id 4 :result nil)
[server-notification] Thu Sep 22 05:47:52 2022:
(:jsonrpc "2.0" :method "textDocument/publishDiagnostics" :params
(:uri "file:///home/msolis/Proyectos/vignettes/test.R" :version 0 :diagnostics
[]))