I have local MacOS(intel) machine running with emacs 27.2 and remote ubuntu 20.0 server for my personal Rust project development with rust-analyzer for lsp.

When I ssh remotely and start emacs on the remote machine, rust-analyzer works fine, but when I start emacs on the local machine and edit the Rust project file after ssh using council-tramp, the following message appears and does not work:

enter image description here

Also, here is my lsp-mode setting below which is inspired by official documentation:

(use-package lsp-mode
   :hook ((rust-mode c++-mode) . lsp)
   :bind ("C-c h" . lsp-describe-thing-at-point)
    (make-lsp-client :new-connection (lsp-tramp-connection "rust-analyzer")
                     :major-modes '(rust-mode)
                     :remote? t
                     :server-id 'rust-analyzer-remote))
   (add-to-list 'tramp-remote-path "~/.cargo/bin/")
   (lsp-rust-server 'rust-analyzer)
   (lsp-rust-analyzer-cargo-watch-command "clippy")
   (lsp-rust-analyzer-inlay-hints-mode t)
   (lsp-rust-analyzer-server-display-inlay-hints t)
   (lsp-rust-analyzer-display-parameter-hints t)
   (lsp-rust-analyzer-display-chaining-hints t))

Is there something I'm doing wrong?

1 Answer 1


There is some questions with lsp-tramp-connection, see this pr


  1. update tramp to 2.5.0
  2. use this lsp-tramp-connection
  (defun lsp-tramp-connection@override (local-command &optional generate-error-file-fn)
    "Create LSP stdio connection named name.
LOCAL-COMMAND is either list of strings, string or function which
returns the command to execute."
    (defvar tramp-connection-properties)
    (list :connect (lambda (filter sentinel name environment-fn)
                     ;; Force a direct asynchronous process.
                     (add-to-list 'tramp-connection-properties
                                  (list (regexp-quote (file-remote-p default-directory))
                                        "direct-async-process" t))
                     (let* ((final-command (lsp-resolve-final-function
                            (process-name (generate-new-buffer-name name))
                            (stderr-buf (format "*%s::stderr*" process-name))
                            (err-buf (generate-new-buffer stderr-buf))
                             (lsp--compute-process-environment environment-fn))
                            (proc (make-process
                                   :name process-name
                                   :buffer (format "*%s*" process-name)
                                   :command final-command
                                   :connection-type 'pipe
                                   :coding 'no-conversion
                                   :noquery t
                                   :filter filter
                                   :sentinel sentinel
                                   :stderr err-buf
                                   :file-handler t)))
                       (cons proc proc)))
          :test? (lambda () (-> local-command lsp-resolve-final-function
  (advice-add 'lsp-tramp-connection :override #'lsp-tramp-connection@override)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.