-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LSP doesn't start over Tramp #217
Comments
Is your LSP server installed on the remote system ? |
Yes - I'm using NixOS, so my local & remote configuration are almost identical; additionally, LSP via
|
I guess you are using rust-analyzer. Can you run it manually on the remote host ? |
Yes, I'm using rust-analyzer - it works on the remote machine:
|
I haven't used lsp-mode on remote hosts, but I just noticed https://emacs-lsp.github.io/lsp-mode/page/remote/. Have you tried it ? |
I've tried adding: (with-eval-after-load "lsp-rust"
(lsp-register-client
(make-lsp-client
:new-connection (lsp-tramp-connection
(executable-find (car lsp-rust-analyzer-server-command)))
:major-modes '(rust-mode rustic-mode)
:priority (if (eq lsp-rust-server 'rust-analyzer) 1 -1)
:remote? t
:initialization-options 'lsp-rust-analyzer--make-init-options
:notification-handlers (ht<-alist lsp-rust-notification-handlers)
:action-handlers (ht<-alist lsp-rust-action-handlers)
:library-folders-fn (lambda (_workspace) lsp-rust-library-directories)
:ignore-messages nil
:server-id 'rust-analyzer-remote))) (and similar ones)
|
Actually, this new error might be emacs-lsp/lsp-mode#2514 - I'll check when I get home later. |
Yeah, adding emacs-lsp/lsp-mode#2514 (comment) and #217 (comment) made LSP work 😄 Thanks for helping! |
What did you do exactly so we can add it to the readme ? |
I added those lines to my ;; fix for Emacs 28 (https://github.com/emacs-lsp/lsp-mode/issues/2514#issuecomment-759452037)
(defun start-file-process-shell-command@around (start-file-process-shell-command name buffer &rest args)
"Start a program in a subprocess. Return the process object for it. Similar to `start-process-shell-command', but calls `start-file-process'."
(let ((command (mapconcat 'identity args " ")))
(funcall start-file-process-shell-command name buffer command)))
(advice-add 'start-file-process-shell-command :around #'start-file-process-shell-command@around)
;; remote rust-analyzer
(with-eval-after-load "lsp-rust"
(lsp-register-client
(make-lsp-client
:new-connection (lsp-tramp-connection
(executable-find (car lsp-rust-analyzer-server-command)))
:major-modes '(rust-mode rustic-mode)
:priority (if (eq lsp-rust-server 'rust-analyzer) 1 -1)
:remote? t
:initialization-options 'lsp-rust-analyzer--make-init-options
:notification-handlers (ht<-alist lsp-rust-notification-handlers)
:action-handlers (ht<-alist lsp-rust-action-handlers)
:library-folders-fn (lambda (_workspace) lsp-rust-library-directories)
:ignore-messages nil
:server-id 'rust-analyzer-remote))) |
Do you want to add a section to the readme ? I haven't set it up myself, so maybe you can add some hints why this is needed. |
Sure, I'll prepare a merge request tomorrow :-) |
Great, thanks! |
Hi,
rustic-mode
works perfectly fine locally, but when started over a Tramp session (via standardC-x C-f /ssh:something
), errors out with:Syntax highlighting works, but LSP doesn't start at all.
For reference, I'm using standard Doom Emacs with no fancy plugins & no fancy configuration.
The text was updated successfully, but these errors were encountered: