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

Tramp support, fixes #84 #463

Closed
wants to merge 81 commits into from
Closed
Changes from 2 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
fdee656
make uri↔path & `make-process` remote-aware
FelipeLema May 8, 2020
0f01fb7
make `executable-find` remote aware
FelipeLema May 8, 2020
8220c42
no multi-byte characters that can be omitted
FelipeLema May 11, 2020
0df2e04
concise documentation per review
FelipeLema May 11, 2020
a1bb6f2
compact code per review
FelipeLema May 11, 2020
96937a3
tramp-file-local-name → file-local-name
FelipeLema May 11, 2020
a1f9105
test remoteness on path (project root)
FelipeLema May 11, 2020
96efc95
run all tests using tramp (remote editing through `ssh localhost`)
FelipeLema May 11, 2020
c9e5aeb
remove redundant comment
FelipeLema May 11, 2020
fb82c10
reported (project) root is relative to server process
FelipeLema May 11, 2020
175a3e2
Merge branch 'master' into tramp-support
FelipeLema May 11, 2020
7e2051a
continuous lines for `install` section in Travis
FelipeLema May 11, 2020
e2f750e
typo: matching parentheses
FelipeLema May 11, 2020
88b6643
ensure temp directories respect remoteness of default-directory
FelipeLema May 12, 2020
be2b870
make tramp even *more* verbose
FelipeLema May 13, 2020
e661edd
make uri↔path & `make-process` remote-aware
FelipeLema May 8, 2020
eea9418
make `executable-find` remote aware
FelipeLema May 8, 2020
b46196c
no multi-byte characters that can be omitted
FelipeLema May 11, 2020
381a98f
concise documentation per review
FelipeLema May 11, 2020
9b490e8
compact code per review
FelipeLema May 11, 2020
2f86f0d
tramp-file-local-name → file-local-name
FelipeLema May 11, 2020
faa15c4
test remoteness on path (project root)
FelipeLema May 11, 2020
69a2fc3
run all tests using tramp (remote editing through `ssh localhost`)
FelipeLema May 11, 2020
bd026db
remove redundant comment
FelipeLema May 11, 2020
5d2e91d
reported (project) root is relative to server process
FelipeLema May 11, 2020
5e2962f
typo: matching parentheses
FelipeLema May 11, 2020
76e2acc
ensure temp directories respect remoteness of default-directory
FelipeLema May 12, 2020
10e291c
make tramp even *more* verbose
FelipeLema May 13, 2020
6515fa7
Use project-root, not project-roots
joaotavora May 28, 2020
6659341
trying out latest fixes from tramp dev branch
FelipeLema Jun 24, 2020
57e0fd5
Merge branch 'tramp-support' of https://github.com/FelipeLema/eglot i…
FelipeLema Jun 24, 2020
8b38aa5
add dev branch tramp to load-path
FelipeLema Jun 24, 2020
afb95b7
correct use of $ in Makefile, remove load-path mangling
FelipeLema Jun 24, 2020
ddc5229
revert experimental code to test eglot+tramp
FelipeLema Jul 1, 2020
4de0b86
missing revert from previous commit
FelipeLema Jul 1, 2020
79716a1
typo
FelipeLema Jul 1, 2020
435685b
copy-paste a tramp version of `auto-detect-running-server`
FelipeLema Jul 1, 2020
10b7a89
wrap command around a "raw IO shell/terminal"
FelipeLema Jul 1, 2020
7356825
ditch stderr for remote processes
FelipeLema Jul 3, 2020
ca1a02c
required package for tramp process to work
FelipeLema Jul 3, 2020
2593cc1
pack "ssh localhost without password" in the unit test
FelipeLema Jul 3, 2020
1d86e2b
print to console output of commands
FelipeLema Jul 6, 2020
3322b4a
I meant "use standard-output"
FelipeLema Jul 6, 2020
9bc6aab
dealing with results-of-commands, not commands
FelipeLema Jul 6, 2020
edd2567
mix stderr with stdout
FelipeLema Jul 6, 2020
e0f4d03
compress code and (hopefully) print error to screen
FelipeLema Jul 6, 2020
d6aefd2
missing closing quote
FelipeLema Jul 6, 2020
78f2b65
guard if ssh has been setup, fix config → ~/.ssh/config
FelipeLema Jul 6, 2020
2b469e1
we're not supposed to use pub files as identity files
FelipeLema Jul 6, 2020
43c7b16
handle permissions
FelipeLema Jul 6, 2020
be5ae62
directory permissions are slightly different
FelipeLema Jul 6, 2020
bbbd8fe
verbose ssh output
FelipeLema Jul 6, 2020
a5dd316
authorized _public_ keys
FelipeLema Jul 6, 2020
ae18955
ensure remote pty by adding `-tt`
FelipeLema Jul 7, 2020
bea55d8
set raw IO quietly
FelipeLema Jul 7, 2020
302c776
forward-declare tramp variables & functions
FelipeLema Jul 7, 2020
ba68757
forward-declare variable set in `with-parsed-tramp-file-name`
FelipeLema Jul 7, 2020
97ad8f1
unused code
FelipeLema Jul 7, 2020
c5df192
correctly make remote directory
FelipeLema Jul 7, 2020
5b0d883
add assertion for testing
FelipeLema Jul 7, 2020
9c4134b
maybe default-directory is not expanding correctly?
FelipeLema Jul 7, 2020
c1564ee
refactor handling of `-tt` in `tramp-methods`
FelipeLema Jul 7, 2020
98956a8
use latest tramp package from ELPA
FelipeLema Jul 8, 2020
e1c14aa
try using eclipse LSP instead of python's
FelipeLema Jul 8, 2020
e60e183
it seems that it's not using the proper executable-find?
FelipeLema Jul 8, 2020
e4fbf16
Merge branch 'master' into tramp-support
FelipeLema Jul 10, 2020
27eccd7
different calls to `executable-find` depending on remote / local
Jul 11, 2020
b7e800c
build setup for no-password ssh login to `localhost` only in travis
Jul 13, 2020
a169588
add basic documentation for Tramp
Jul 13, 2020
3e8221a
Merge branch 'master' into tramp-support
FelipeLema Jul 13, 2020
00b196a
fix 3e8221ac
Jul 13, 2020
c5ac58b
add trailing newline
Jul 13, 2020
0a98071
revert trailing newlines in eglot{,-tests}.el to original
Jul 13, 2020
9b8eb24
call `eglot--maybe-activate-editing-mode` only on reachable buffers
Jul 20, 2020
a7f5a3f
use the full path to get tramp prefix, not `file-local-name`
Jul 20, 2020
0e10c31
don't provide `processId` for servers executing remotely
Jul 21, 2020
062d16d
add the hostname in the nickname
Jul 29, 2020
ab38015
format nickname as "host:directory" instead of "directory@host"
Jul 30, 2020
6f82edd
Introduce "note for special case of tramp commands not in PATH"
Aug 3, 2020
981aa45
explain reason for filtering buffers by tramp prefix, revert indent
Aug 11, 2020
857c89f
replace / avoid non-ascii chararters
Aug 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
(defvar company-backends)
(defvar company-tooltip-align-annotations)

(declare-function tramp-file-local-name "tramp" t t)
FelipeLema marked this conversation as resolved.
Show resolved Hide resolved


;;; User tweakable stuff
Expand Down Expand Up @@ -718,7 +719,11 @@ be guessed."
((null guess)
(format "[eglot] Sorry, couldn't guess for `%s'!\n%s"
managed-mode base-prompt))
((and program (not (executable-find program)))
((and program
(not
(executable-find program
(if (file-remote-p default-directory)
FelipeLema marked this conversation as resolved.
Show resolved Hide resolved
t))))
(concat (format "[eglot] I guess you want to run `%s'"
program-guess)
(format ", but I can't find `%s' in PATH!" program)
Expand Down Expand Up @@ -877,6 +882,7 @@ This docstring appeases checkdoc, that's all."
:connection-type 'pipe
:coding 'utf-8-emacs-unix
:noquery t
:file-handler (file-remote-p default-directory)
:stderr (get-buffer-create
(format "*%s stderr*" readable-name)))))))))
(spread (lambda (fn) (lambda (server method params)
Expand Down Expand Up @@ -1001,6 +1007,9 @@ CONNECT-ARGS are passed as additional arguments to
:name (format "autostart-inferior-%s" name)
:stderr (format "*%s stderr*" name)
:noquery t
:file-handler (file-remote-p
;; ↓ set at `eglot--connect'
FelipeLema marked this conversation as resolved.
Show resolved Hide resolved
default-directory)
:command (cl-subst
(format "%s" port-number) :autoport contact)))
(setq connection
Expand Down Expand Up @@ -1131,14 +1140,22 @@ If optional MARKER, return a marker instead"
(defun eglot--path-to-uri (path)
"URIfy PATH."
(url-hexify-string
(concat "file://" (if (eq system-type 'windows-nt) "/") (file-truename path))
(concat "file://" (if (eq system-type 'windows-nt) "/")
(tramp-file-local-name (file-truename path)))
url-path-allowed-chars))

(defun eglot--uri-to-path (uri)
"Convert URI to a file path."
(cl-defun eglot--uri-to-path (uri &optional (server (eglot--current-server-or-lose)))
"Convert URI to a file path.
FelipeLema marked this conversation as resolved.
Show resolved Hide resolved

SERVER is used to resolve the remote component of the path being returned,
since server may be running in a remote host.

Will use `eglot--current-server-or-lose' if SERVER not provided."
(when (keywordp uri) (setq uri (substring (symbol-name uri) 1)))
(let ((retval (url-filename (url-generic-parse-url (url-unhex-string uri)))))
(if (eq system-type 'windows-nt) (substring retval 1) retval)))
(concat
(file-remote-p (jsonrpc--process server))
(let ((retval (url-filename (url-generic-parse-url (url-unhex-string uri)))))
(if (eq system-type 'windows-nt) (substring retval 1) retval))))

(defun eglot--snippet-expansion-fn ()
"Compute a function to expand snippets.
Expand Down Expand Up @@ -1547,7 +1564,7 @@ COMMAND is a symbol naming the command."
(server (_method (eql textDocument/publishDiagnostics)) &key uri diagnostics
&allow-other-keys) ; FIXME: doesn't respect `eglot-strict-mode'
"Handle notification publishDiagnostics"
(if-let ((buffer (find-buffer-visiting (eglot--uri-to-path uri))))
(if-let ((buffer (find-buffer-visiting (eglot--uri-to-path uri server))))
(with-current-buffer buffer
(cl-loop
for diag-spec across diagnostics
Expand Down Expand Up @@ -1767,7 +1784,7 @@ When called interactively, use the currently active server"
(mapcar
(eglot--lambda ((ConfigurationItem) scopeUri section)
(with-temp-buffer
(let* ((uri-path (eglot--uri-to-path scopeUri))
(let* ((uri-path (eglot--uri-to-path scopeUri server))
(default-directory
(if (and (not (string-empty-p uri-path))
(file-directory-p uri-path))
Expand Down