Skip to content

Commit 541f797

Browse files
committed
Use executable-find with remote = t everywhere
1 parent 53cbca8 commit 541f797

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

lsp-mode.el

+11-15
Original file line numberDiff line numberDiff line change
@@ -7307,16 +7307,11 @@ Return a nested alist keyed by symbol names. e.g.
73077307

73087308
(defun lsp-server-present? (final-command)
73097309
"Check whether FINAL-COMMAND is present."
7310-
;; executable-find only gained support for remote checks after 27 release
7311-
(or (and (cond
7312-
((not (file-remote-p default-directory))
7313-
(executable-find (cl-first final-command)))
7314-
((version<= "27.0" emacs-version)
7315-
(with-no-warnings (executable-find (cl-first final-command) (file-remote-p default-directory))))
7316-
(t))
7317-
(prog1 t
7318-
(lsp-log "Command \"%s\" is present on the path." (s-join " " final-command))))
7319-
(ignore (lsp-log "Command \"%s\" is not present on the path." (s-join " " final-command)))))
7310+
(let ((binary-found? (executable-find (cl-first final-command) t)))
7311+
(if binary-found?
7312+
(lsp-log "Command \"%s\" is present on the path." (s-join " " final-command))
7313+
(lsp-log "Command \"%s\" is not present on the path." (s-join " " final-command)))
7314+
binary-found?))
73207315

73217316
(defun lsp--value-to-string (value)
73227317
"Convert VALUE to a string that can be set as value in an environment
@@ -7464,7 +7459,7 @@ process listening for TCP connections on the provided port."
74647459
(port (lsp--find-available-port host (cl-incf lsp--tcp-port)))
74657460
(command (funcall command-fn port))
74667461
(final-command (if (consp command) command (list command)))
7467-
(_ (unless (executable-find (cl-first final-command))
7462+
(_ (unless (lsp-server-present? final-command)
74687463
(user-error (format "Couldn't find executable %s" (cl-first final-command)))))
74697464
(process-environment
74707465
(lsp--compute-process-environment environment-fn))
@@ -7477,7 +7472,7 @@ process listening for TCP connections on the provided port."
74777472
(set-process-query-on-exit-flag tcp-proc nil)
74787473
(set-process-filter tcp-proc filter)
74797474
(cons tcp-proc proc)))
7480-
:test? (lambda () (executable-find (cl-first (funcall command-fn 0))))))
7475+
:test? (lambda () (lsp-server-present? (funcall command-fn 0)))))
74817476

74827477
(defalias 'lsp-tcp-server 'lsp-tcp-server-command)
74837478

@@ -7528,7 +7523,7 @@ should return the command to start the LS server."
75287523
(set-process-filter tcp-client-connection filter)
75297524
(set-process-sentinel tcp-client-connection sentinel)
75307525
(cons tcp-client-connection cmd-proc)))
7531-
:test? (lambda () (executable-find (cl-first (funcall command-fn 0))))))
7526+
:test? (lambda () (lsp-server-present? (funcall command-fn 0)))))
75327527

75337528
(defalias 'lsp-tramp-connection 'lsp-stdio-connection)
75347529

@@ -8062,7 +8057,7 @@ nil."
80628057
(if (and (f-absolute? path)
80638058
(f-exists? path))
80648059
path
8065-
(executable-find path))))
8060+
(executable-find path t))))
80668061

80678062
(defun lsp-package-path (dependency)
80688063
"Path to the DEPENDENCY each of the registered providers."
@@ -8095,7 +8090,8 @@ nil."
80958090
(f-join lsp-server-install-dir "npm" package
80968091
(cond ((eq system-type 'windows-nt) "")
80978092
(t "bin"))
8098-
path))))
8093+
path)
8094+
t)))
80998095
(unless (and path (f-exists? path))
81008096
(error "The package %s is not installed. Unable to find %s" package path))
81018097
path))

0 commit comments

Comments
 (0)