I am trying to work remotely on a typescript project, with lsp-mode
and tramp
, through SSH.
I followed the documentation on lsp-mode web page to set up a remote client. Here is my config:
(use-package lsp-mode
:commands (lsp lsp-deferred)
:init
(setq lsp-keymap-prefix "C-c l")
:bind (:map lsp-mode-map
("TAB" . completion-at-point))
:config
(lsp-enable-which-key-integration t))
(require 'lsp-mode)
(setq tramp-remote-path '(tramp-default-remote-path "~/.local/bin/" "/usr/local/bin/"))
(use-package typescript-mode
:mode "\\.ts\\'"
:hook (typescript-mode . lsp))
(require 'typescript-mode)
(lsp-register-client
(make-lsp-client :new-connection (lsp-tramp-connection (list "typescript-language-server" "--stdio"))
:major-modes '(typescript-mode)
:remote? t
:server-id 'ts-ls))
And typescript-language-server
is installed on my remote machine, version 0.8.1. I am able to use typescript with lsp-mode locally just fine. For that, I followed lsp documentation for setting up ts-ls. Still, I get the following error when I open a remote project:
LSP :: There are no language servers supporting current mode
typescript-mode' registered with
lsp-mode'. This issue might be caused by:
- The language you are trying to use does not have built-in support in
lsp-mode'. You must install the required support manually. Examples of this are
lsp-java' or `lsp-metals'.- The language server that you expect to run is not configured to run for major mode
typescript-mode'. You may check that by checking the
:major-modes' that are passed to `lsp-register-client'.lsp-mode' doesn't have any integration for the language behind
typescript-mode'. Refer to https://emacs-lsp.github.io/lsp-mode/page/languages and https://langserver.org/ .- You are over `tramp'. In this case follow https://emacs-lsp.github.io/lsp-mode/page/remote/.
- You have disabled the
lsp-mode' clients for that file. (Check
lsp-enabled-clients' and `lsp-disabled-clients').
I think 1 does not apply to me since typescript is supported by lsp-mode. For 2, you can see that I added typescript-mode as major mode in my lsp-register-client. I have checked lsp-enabled-clients for point 5 and it was nil, which meant all were registered. For the point 3, I know lsp-mode has integration for typescript since I locally use it.
Only point remaining for me is 4, I guess. There I suspect my config I shared above might be wrong. Any suggestions?
(setq tramp-remote-path '(tramp-default-remote-path "~/.local/bin/" "/usr/local/bin/"))
looks suspicious. I'd rather append your own settings, by something like(setq tramp-remote-path (append tramp-remote-path '("~/.local/bin/")))
."/usr/local/bin/"
is already present.tramp-verbose
set to 6, and contact us via[email protected]
.typescript-language-server
binary is present in one of the directories intramp-remote-path
. (by checkingtramp
file inside my.emacs.d
. I just can't figure out why lsp can't start this language server remotely for Typescript. I can use clangd for C++ over Tramp just fine. Typescript integration in lsp over Tramp is the issue. I suspect issue is on the lsp side.tramp-verbose
to 6, rerun your test, and send the resulting traces to the mail address above.