Skip to content

Commit

Permalink
Remove custom script for lsp-elixir server. (#2764)
Browse files Browse the repository at this point in the history
- Rename `lsp-clients-elixir-server-executable` to
 `lsp-elixit-server-command`.
 - Mark `lsp-clients-elixir-server-executable` as obsolete.
 - Define `elixir-ls` as lsp dependency.
 - Update how new connection is done for elixir-ls.
  • Loading branch information
hjpotter92 authored Apr 5, 2021
1 parent c3bbea5 commit c32d1c8
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions clients/lsp-elixir.el
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ If value is `\"\"` then defaults to the workspace rootUri."
:group 'lsp-mode
:link '(url-link "https://github.com/elixir-lsp/elixir-ls"))

(defcustom lsp-clients-elixir-server-executable
(if (equal system-type 'windows-nt)
"language_server.bat"
"language_server.sh")
"The elixir-language-server executable to use.
Leave as just the executable name to use the default behavior of
finding the executable with `exec-path'."
(define-obsolete-variable-alias 'lsp-clients-elixir-server-executable 'lsp-elixir-server-command "2021-04-05")

(defcustom lsp-elixir-server-command '("elixir-ls")
"Command to start elixir-ls.
Leave as default to let `executable-find' search for it."
:group 'lsp-elixir
:type 'file)
:type '(repeat string)
:package-version '(lsp-mode . "7.1"))

(defcustom lsp-elixir-enable-test-lenses t
"Suggest Tests."
Expand Down Expand Up @@ -129,6 +129,9 @@ finding the executable with `exec-path'."
" --no-color"))
file-path))

(lsp-dependency 'elixir-ls
'(:system "elixir-ls"))

(lsp-register-custom-settings
'(("elixirLS.dialyzerEnabled" lsp-elixir-dialyzer-enabled t)
("elixirLS.dialyzerWarnOpts" lsp-elixir-dialyzer-warn-opts)
Expand All @@ -142,7 +145,12 @@ finding the executable with `exec-path'."
("elixirLS.enableTestLenses" lsp-elixir-enable-test-lenses t)))

(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection (lambda () `(,lsp-clients-elixir-server-executable)))
(make-lsp-client :new-connection (lsp-stdio-connection
(lambda ()
`(,(or (executable-find
(cl-first lsp-elixir-server-command))
(lsp-package-path 'elixir-ls))
,@(cl-rest lsp-elixir-server-command))))
:major-modes '(elixir-mode)
:priority -1
:server-id 'elixir-ls
Expand Down

0 comments on commit c32d1c8

Please sign in to comment.