Skip to content
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-java-server-install-dir variable does not seem to work #470

Closed
ircurry opened this issue Mar 24, 2024 · 2 comments
Closed

lsp-java-server-install-dir variable does not seem to work #470

ircurry opened this issue Mar 24, 2024 · 2 comments

Comments

@ircurry
Copy link

ircurry commented Mar 24, 2024

Describe the bug
No matter what I set lsp-java-server-install-dir to, emacs always prompts me to install the language server.

To Reproduce
Using the version of emacs, lsp, lsp-java, and jdt-language-server from my flake and this elisp code:

;; ===Java Tree-Sitter Mode===
(use-package java-ts-mode
  :mode "\\.java\\'")

;; ===lsp-java===
(use-package lsp-java
  ;:ensure t
  :after (lsp-mode cc-mode)
  :init
  :hook
  (envrc-mode . (lambda ()
		  (when (equal major-mode 'java-ts-mode)
		    (setq lsp-java-server-install-dir (concat (getenv "JDTLS_PATH") "/share/java/")))))
  (java-ts-mode . lsp-deferred)
  :config
  (defun lsp-java--ls-command ()
    (let ((jdtls-path (getenv "JDTLS_PATH"))
	  (jdtls-exec-options (list
			       "-configuration"
			       (concat (getenv "HOME") "/.jdtls/config_linux")
			       "-data"
			       (concat (getenv "HOME") "/.jdtls/java-workspace"))))
      (message (concat jdtls-path "/share/java/"))
      (append (list (concat jdtls-path "/bin/jdtls")) jdtls-exec-options))))

Expected behavior
Based on what I have gotten from the doc strings, this issue, and #421, I would expect for the server to execute as if that same jdtls version was installed at the default location.

Screenshots
image

@ircurry
Copy link
Author

ircurry commented Mar 24, 2024

Would this issue be fixed with #463 or am I misunderstanding what this pull request does?

@ircurry
Copy link
Author

ircurry commented Mar 24, 2024

I have figured out the issue. The string concatenated should have been "/share/java/jdtls/" not "/share/java/". A quick look at where lsp-java-server-install-dir is used, specifically lsp-java--locate-server-jar, and the files in the store would quickly revealed this and saved me so much time and pain.

@ircurry ircurry closed this as completed Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant