[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 0e6c0619da 09/33: Fix #703: Don't call eglot--exe
From: |
Stefan Kangas |
Subject: |
[elpa] externals/eglot 0e6c0619da 09/33: Fix #703: Don't call eglot--executable-find more than needed |
Date: |
Sat, 8 Jan 2022 12:30:48 -0500 (EST) |
branch: externals/eglot
commit 0e6c0619daa39c6b26c2592b01f411613e788815
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Fix #703: Don't call eglot--executable-find more than needed
* eglot.el (eglot-alternatives): Complexify.
(eglot--guess-contact): No need to 'executable-find' if path
absolute.
---
eglot.el | 48 +++++++++++++++++++++++++++++++++++-------------
1 file changed, 35 insertions(+), 13 deletions(-)
diff --git a/eglot.el b/eglot.el
index a6c60e9578..927009a8a9 100644
--- a/eglot.el
+++ b/eglot.el
@@ -99,22 +99,42 @@
"Compute server-choosing function for `eglot-server-programs'.
Each element of ALTERNATIVES is a string PROGRAM or a list of
strings (PROGRAM ARGS...) where program names an LSP server
-program to start with ARGS. Returns a function of one
-argument."
+program to start with ARGS. Returns a function of one argument.
+When invoked, that function will return a list (ABSPATH ARGS),
+where ABSPATH is the absolute path of the PROGRAM that was
+chosen (interactively or automatically)."
(lambda (&optional interactive)
+ ;; JT@2021-06-13: This function is way more complicated than it
+ ;; could be because it accounts for the fact that
+ ;; `eglot--executable-find' may take much longer to execute on
+ ;; remote files.
(let* ((listified (cl-loop for a in alternatives
collect (if (listp a) a (list a))))
- (available (cl-remove-if-not (lambda (a) (eglot--executable-find a
t))
- listified :key #'car)))
- (cond ((and interactive (cdr available))
- (let ((chosen (completing-read
- "[eglot] More than one server executable
available:"
- (mapcar #'car available)
- nil t nil nil (car (car available)))))
- (assoc chosen available #'equal)))
- ((car available))
+ (err (lambda ()
+ (error "None of '%s' are valid executables"
+ (mapconcat #'identity alternatives ", ")))))
+ (cond (interactive
+ (let* ((augmented (mapcar (lambda (a)
+ (let ((found (eglot--executable-find
+ (car a) t)))
+ (and found
+ (cons (car a) (cons found (cdr
a))))))
+ listified))
+ (available (remove nil augmented)))
+ (cond ((cdr available)
+ (cdr (assoc
+ (completing-read
+ "[eglot] More than one server executable
available:"
+ (mapcar #'car available)
+ nil t nil nil (car (car available)))
+ available #'equal)))
+ ((cdr (car available)))
+ (t (funcall err)))))
(t
- (car listified))))))
+ (cl-loop for (p . args) in listified
+ for probe = (eglot--executable-find p t)
+ when probe return (cons probe args)
+ finally (funcall err)))))))
(defvar eglot-server-programs `((rust-mode . (eglot-rls "rls"))
(python-mode
@@ -833,7 +853,9 @@ be guessed."
((null guess)
(format "[eglot] Sorry, couldn't guess for `%s'!\n%s"
managed-mode base-prompt))
- ((and program (not (eglot--executable-find program t)))
+ ((and program
+ (not (file-name-absolute-p program))
+ (not (eglot--executable-find program t)))
(concat (format "[eglot] I guess you want to run `%s'"
program-guess)
(format ", but I can't find `%s' in PATH!"
program)
- [elpa] externals/eglot 835aa0e9b3 06/33: Per #697, #645: Hard code an exception to "node_modules" directores, (continued)
- [elpa] externals/eglot 835aa0e9b3 06/33: Per #697, #645: Hard code an exception to "node_modules" directores, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot a5b7b7d933 04/33: Fix #688: Support multiple servers out-of-box for same mode, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot 194b178ef4 11/33: Close #712: Add support for LocationLink, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot 122dbb9d6e 14/33: Fix typo in user-visible eglot-ignored-server-capabilities, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot 9b63f21e75 15/33: Respect completion-regexp-alist in Eglot's completion table, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot c3f1b7b43f 25/33: Fix #779: Correct "GNU ELPA" typo, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot 670ee61169 23/33: Close #770: Mark eglot-completion-at-point capf "non-exclusive", Stefan Kangas, 2022/01/08
- [elpa] externals/eglot 5a717c3861 01/33: Fix #671: Allow staying out of flymake-mode, eldoc-mode, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot 44504db1ea 28/33: Use `locate-user-emacs-file` instead of `concat`, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot 5cc8df63d8 08/33: Fix #702: Consider TRAMP in eglot-alternatives, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot 0e6c0619da 09/33: Fix #703: Don't call eglot--executable-find more than needed,
Stefan Kangas <=
- [elpa] externals/eglot c17bdf6c98 16/33: Fixup last commit, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot 8b15bf726f 19/33: Test javascript-basic with typescript-language-server, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot 44793b6e07 20/33: Fix issues #755, #401; severity not set in textDocument/publishDiagnostics, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot b197e092f9 33/33: ; Fix typos, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot 91b3f60d67 31/33: Add yaml-language-server for yaml-mode, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot 04d2d6f783 02/33: Fix #649: two typos, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot e498cb171b 07/33: Per #697: Use project-files to know which directory watchers to skip, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot 25d20c73cf 05/33: Fix #697, #645: Again speed up directory watching, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot cbb1da42be 12/33: Let eglot-flymake-backend be in flymake-d-functions even if Eglot off, Stefan Kangas, 2022/01/08
- [elpa] externals/eglot a697084d8d 13/33: Fix #719: fall back to prompting user if eglot-alternatives fails, Stefan Kangas, 2022/01/08