Spacemacs has issues using LSP via TRAMP that are not present in vanilla emacs. In particular, it opens many SSH connections, spawning a clangd (or ccls; I tested C++ only) for each source file related to the opened one. I've no idea how to debug this, I hope others will be able to reproduce this. It may be related to #11514.
Reproduction guide :beetle:
Start with a brand new .spacemacs file, only add lsp and c-c++ layers.
Prepare a test project on a remote server, with compile_commands.json file at the top level.
Create a file lsp-tramp-test.el (content quoted below); it installs lsp-mode and opens two remote source files.
Start emacs using emacs -q -l lsp-tramp-test.el. This starts vanilla emacs.
Use M-x lsp to start lsp-mode in each of the two buffers with C/C++ code.
Run lsp-describe-session.
Close emacs.
Start emacs using emacs -l lsp-tramp-test.el. This starts spacemacs.
Run lsp-describe-session.
Observed behaviour: :eyes: :broken_heart:
Vanilla emacs behaves as expected. lsp-describe-session shows only one clangd instance, both files belong to it.
Spacemacs takes a while to start, depending on how many source files are in the project because it opens many connections. lsp-describe-session shows many clangd instances, not all of them have the same source files associated with them.
I have observed many other weird issues trying to use LSP remotely, but I'm not sure which are related and which are not, so I'm just focusing on the multiple language server instances issue for now. It's the most important, I think, because even in the best case, having too many connections opened causes things to freeze at some point (where "things" means both emacs and SSH itself, depending on SSH server configuration).
Expected behaviour: :heart: :smile:
Spacemacs should only start one clangd instance for the project, same as vanilla emacs.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!
Description :octocat:
Spacemacs has issues using LSP via TRAMP that are not present in vanilla emacs. In particular, it opens many SSH connections, spawning a
clangd
(orccls
; I tested C++ only) for each source file related to the opened one. I've no idea how to debug this, I hope others will be able to reproduce this. It may be related to #11514.Reproduction guide :beetle:
.spacemacs
file, only addlsp
andc-c++
layers.compile_commands.json
file at the top level.lsp-tramp-test.el
(content quoted below); it installslsp-mode
and opens two remote source files.emacs -q -l lsp-tramp-test.el
. This starts vanilla emacs.M-x lsp
to startlsp-mode
in each of the two buffers with C/C++ code.lsp-describe-session
.emacs -l lsp-tramp-test.el
. This starts spacemacs.lsp-describe-session
.Observed behaviour: :eyes: :broken_heart:
lsp-describe-session
shows only oneclangd
instance, both files belong to it.lsp-describe-session
shows manyclangd
instances, not all of them have the same source files associated with them.I have observed many other weird issues trying to use LSP remotely, but I'm not sure which are related and which are not, so I'm just focusing on the multiple language server instances issue for now. It's the most important, I think, because even in the best case, having too many connections opened causes things to freeze at some point (where "things" means both emacs and SSH itself, depending on SSH server configuration).
Expected behaviour: :heart: :smile: Spacemacs should only start one
clangd
instance for the project, same as vanilla emacs.System Info :computer:
Test file
Modify the remote file paths.
lsp-tramp-test.el