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

Use tramp's remote shell #4384

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 15 additions & 9 deletions lsp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -7346,6 +7346,18 @@ Return a nested alist keyed by symbol names. e.g.
(when menu-bar-mode
(lsp--imenu-refresh)))

(defun lsp--get-tramp-remote-shell ()
"Get the `tramp-remote-shell' for the current Tramp connection."
(let* ((vec (tramp-dissect-file-name default-directory))
(remote-shell (tramp-get-connection-property vec "remote-shell" nil)))
remote-shell))

(defun lsp--raw-terminal-mode-command (command)
(list (lsp--get-tramp-remote-shell) "-c"
(string-join (cons "stty raw > /dev/null;"
(mapcar #'shell-quote-argument command))
" ")))

(defun lsp-resolve-final-command (command &optional test?)
"Resolve final function COMMAND."
(let* ((command (lsp-resolve-value command))
Expand All @@ -7356,11 +7368,8 @@ Return a nested alist keyed by symbol names. e.g.
command)
(string (list command)))))
(if (and (file-remote-p default-directory) (not test?))
(list shell-file-name "-c"
(string-join (cons "stty raw > /dev/null;"
(mapcar #'shell-quote-argument command))
" "))
command)))
(lsp--raw-terminal-mode-command command)
command)))

(defun lsp-server-present? (final-command)
"Check whether FINAL-COMMAND is present."
Expand Down Expand Up @@ -7410,10 +7419,7 @@ corresponding to PATH, else returns `default-directory'."
Originally coppied from eglot."

(if (file-remote-p default-directory)
(list shell-file-name "-c"
(string-join (cons "stty raw > /dev/null;"
(mapcar #'shell-quote-argument program))
" "))
(lsp--raw-terminal-mode-command command)
program))

(defvar tramp-use-ssh-controlmaster-options)
Expand Down