Skip to content

Commit 0c46787

Browse files
committed
fix: properly use system installed ltex-ls
Fixes: #17
1 parent a0970fb commit 0c46787

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lsp-ltex.el

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,13 @@ If current server not found, install it then."
352352
"Return the server entry file.
353353
354354
This file is use to activate the language server."
355-
(concat (file-name-as-directory (lsp-ltex--extension-root))
356-
(file-name-as-directory "bin")
357-
(if (eq system-type 'windows-nt)
358-
"ltex-ls.bat"
359-
"ltex-ls")))
355+
(if (lsp-ltex--store-locally-p)
356+
(concat (file-name-as-directory (lsp-ltex--extension-root))
357+
(file-name-as-directory "bin")
358+
(if (eq system-type 'windows-nt)
359+
"ltex-ls.bat"
360+
"ltex-ls"))
361+
(executable-find "ltex-ls")))
360362

361363
(defun lsp-ltex--server-command ()
362364
"Startup command for LTEX language server."
@@ -396,7 +398,7 @@ This file is use to activate the language server."
396398
(make-lsp-client
397399
:new-connection (lsp-stdio-connection
398400
#'lsp-ltex--server-command
399-
(lambda () (file-exists-p (lsp-ltex--extension-root))))
401+
(lambda () (and (file-executable-p (lsp-ltex--server-entry)) (file-exists-p (lsp-ltex--server-entry)))))
400402
:activation-fn (lambda (&rest _) (apply #'derived-mode-p lsp-ltex-active-modes))
401403
:priority -2
402404
:add-on? t

0 commit comments

Comments
 (0)