I am trying to work remotely on a typescript project, with
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))
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 withlsp-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 arelsp-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 behindtypescript-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. (Checklsp-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?