Skip to content

Commit

Permalink
[lsp-magik] Support JAVA_HOME with trailing slash (#4139)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiaanspeck authored Aug 22, 2023
1 parent 936ca44 commit 72649c7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions clients/lsp-magik.el
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@
:group `lsp-magik
:package-version '(lsp-mode . "8.0.1"))

(defcustom lsp-magik-java-path (cond ((eq system-type 'windows-nt) "$JAVA_HOME/bin/java")
(t "java"))
(defcustom lsp-magik-java-path (lambda ()
(cond ((eq system-type 'windows-nt)
(or (lsp-resolve-value (executable-find (expand-file-name "bin/java" (getenv "JAVA_HOME"))))
(lsp-resolve-value (executable-find "java"))))
(t "java")))
"Path of the java executable."
:type 'string
:group `lsp-magik
Expand All @@ -108,7 +111,7 @@
:new-connection (lsp-stdio-connection
(lambda ()
(list
(substitute-in-file-name lsp-magik-java-path)
(substitute-in-file-name (lsp-resolve-value lsp-magik-java-path))
"-jar"
(substitute-in-file-name lsp-magik-ls-path)
"--debug")))
Expand Down

0 comments on commit 72649c7

Please sign in to comment.