Skip to content
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

Eglot should use shell-file-name when launching the server for a remote file #1175

Closed
jeberger opened this issue Feb 23, 2023 · 3 comments
Closed

Comments

@jeberger
Copy link

Steps to reproduce:

  • On the remote machine:
    • Install a language server in a non-standard path (e.g. rust-analyzer, which installs in a subdirectory under $HOME and not /usr/bin)
    • Make sure that the server is in the path for a shell other than sh (e.g. set the path in .zprofile for zsh).
  • On the local machine:
    • Open a file remotely through TRAMP
    • Set shell-file-name to the shell you're using on the remote (e.g. (setq shell-file-name "zsh"))
    • M-x eglot.

Expected result:

Eglot should start

Actual result:

Eglot asks Enter program to execute (or <host>:<port>):, then when I type rust-analyzer it fails with message [jsonrpc] Server exited with status 127. Looking at eglot-events-buffer, it is clear that eglot tried to use sh to start the server.

Partial fix

The server starts correctly if I change function eglot--cmd to use (or shell-file-name "sh") instead of plain "sh", e.g.:

(defun eglot--cmd (contact)
  "Helper for `eglot--connect'."
  (if (file-remote-p default-directory)
      ;; TODO: this seems like a bug, although it’s everywhere. For
      ;; some reason, for remote connections only, over a pipe, we
      ;; need to turn off line buffering on the tty.
      ;;
      ;; Not only does this seem like there should be a better way,
      ;; but it almost certainly doesn’t work on non-unix systems.
      (list (or shell-file-name "sh") "-c"
            (string-join (cons "stty raw > /dev/null;"
                               (mapcar #'shell-quote-argument contact))
                         " "))
    contact))

It still fails to autodetect the server and asks for the program to execute though.

@joaotavora
Copy link
Owner

Please report this to the Emacs bug tracker with M-x report-emacs-bug and put Michael Albinus and me in CC: or X-Debbugs-CC:. I have very little TRAMP experience.

@jeberger
Copy link
Author

Please report this to the Emacs bug tracker with M-x report-emacs-bug and put Michael Albinus and me in CC: or X-Debbugs-CC:. I have very little TRAMP experience.

Done: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61748 but I couldn't put you or Michael Albinus in CC since I don't have your email addresses.

@joaotavora
Copy link
Owner

Closing. Let's continue in that bug. I've also reproduced the problem in the meantime, and it's indeed a bit annoying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants