-
-
Notifications
You must be signed in to change notification settings - Fork 893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lsp-magik] Support JAVA_HOME with trailing slash #4139
[lsp-magik] Support JAVA_HOME with trailing slash #4139
Conversation
Can this PR please get a review? |
clients/lsp-magik.el
Outdated
@@ -88,7 +88,8 @@ | |||
: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") | |||
(defcustom lsp-magik-java-path (cond ((eq system-type 'windows-nt) (or (executable-find (expand-file-name "bin/java" (getenv "JAVA_HOME"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont like this to be executed on load time. Imagine every package to perform that on startup similar logic - it will kill lsp-mode's load time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would you suggest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use lambda and then lsp-resolve-value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this?:
(defcustom lsp-magik-java-path (cond ((eq system-type 'windows-nt)
(lambda ()
(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
:package-version '(lsp-mode . "8.0.1"))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to me, it looks like it will be better to wrap the whole thing in a lambda
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review the latest update
Thank you! |
If
$JAVA_HOME
ends with a"/"
, which is the case when using OpenJDK e.a, the current code doesn't work. It would set it tobin/java
. Using the new code, we addbin/java
to the result of$JAVA_HOME
. To work for a$JAVA_HOME
that doesn't end with a"/"
, we use(expand-file-name...
, which adds a"/"
, but only if needed.