Skip to content

Commit 791bd42

Browse files
authored
Merge pull request #24 from abougouffa/fix/install
Usage with system installation
2 parents a0970fb + a2edca4 commit 791bd42

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lsp-ltex.el

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ This is use to active language server and check if language server's existence."
296296
'ltex-ls
297297
'(:system "ltex-ls")
298298
`(:download :url ,lsp-ltex--server-download-url
299-
:store-path ,(lsp-ltex--downloaded-extension-path))))
299+
:store-path ,(lsp-ltex--downloaded-extension-path))))
300300

301301
(defcustom lsp-ltex-version (or (lsp-ltex--current-version)
302302
(lsp-ltex--latest-version)
@@ -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)