fix(lsp-java): point jdtls to proper directory locations
Apparently, the per-project directory system I was using isn't supported by the language server... even though there is absolutely no documentation specifying that.
This commit is contained in:
parent
1b56e781c2
commit
f9793c25a6
1 changed files with 19 additions and 8 deletions
27
config.org
27
config.org
|
|
@ -4219,15 +4219,26 @@ The =lsp-java= package provides LSP support using the standard Java language ser
|
||||||
(setq lsp-java-jdt-ls-prefer-native-command t))
|
(setq lsp-java-jdt-ls-prefer-native-command t))
|
||||||
(add-hook! java-mode
|
(add-hook! java-mode
|
||||||
(setq-local lsp-java-server-install-dir
|
(setq-local lsp-java-server-install-dir
|
||||||
(concat (+lsp-java-server-store-path) "/share/java/jdtls/")))
|
(f-slash (+lsp-java-server-store-path))))
|
||||||
|
|
||||||
(defadvice! ~/lsp-java-ls-command ()
|
;; The relative locations of the binary and jar file are different
|
||||||
"Configure `lsp-java' to work with Nix."
|
;; on NixOS than on most other Linux distros
|
||||||
:override #'lsp-java--ls-command
|
|
||||||
(let ((root (or (doom-project-root) (f-join (getenv "XDG_DATA_HOME") "jdtls"))))
|
(defadvice! ~/lsp-java-locate-server-jar (old-fn)
|
||||||
(list lsp-java-jdt-ls-command
|
:around #'lsp-java--locate-server-jar
|
||||||
"-configuration" (f-join root "config-linux")
|
(let ((lsp-java-server-install-dir
|
||||||
"-data" (f-join root "java-workspace"))))
|
(concat lsp-java-server-install-dir "share/java/jdtls/")))
|
||||||
|
(funcall old-fn)))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
*** Project File Conflict
|
||||||
|
|
||||||
|
Doom's standard library allows for an empty =.project= file to mark the root of a project directory. This is a decent idea, but unfortunately Gradle's project structure contains a file of that name that isn't necessarily at the root, and so this must be disabled to prevent Doom from breaking those projects.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(after! projectile
|
||||||
|
(setq projectile-project-root-files-bottom-up
|
||||||
|
(delete ".project" projectile-project-root-files-bottom-up)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Language Servers
|
** Language Servers
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue