1

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:

  1. 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'.
  2. 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'.
  3. 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/ .
  4. You are over `tramp'. In this case follow https://emacs-lsp.github.io/lsp-mode/page/remote/.
  5. 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?

4
  • Hard to say, I don't use lsp-mode. Reading your conf, the entry (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. Jan 9, 2022 at 9:38
  • And if this still doesn't work, please produce Tramp traces with tramp-verbose set to 6, and contact us via [email protected]. Jan 9, 2022 at 9:39
  • I can see that typescript-language-server binary is present in one of the directories in tramp-remote-path. (by checking tramp 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.
    – meguli
    Jan 10, 2022 at 18:08
  • Set tramp-verbose to 6, rerun your test, and send the resulting traces to the mail address above. Jan 11, 2022 at 7:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.