From: Philip Kaludercic <philipk@posteo.net>
To: 69989@debbugs.gnu.org
Cc: "João Távora" <joaotavora@gmail.com>
Subject: bug#69989: [PATCH] Fix invocation of Java Language Server
Date: Sun, 24 Mar 2024 20:34:26 +0000 [thread overview]
Message-ID: <87y1a78j3h.fsf@posteo.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 582 bytes --]
It appears that the Java Language Server "jdtls" unfortunately requires
a "-data" flag to be passed along with some directory to function
properly. Otherwise it fails or only provides primitive syntax
checking, and no completion or other warnings. This was discussed on
the Eglot issue tracker [0].
The following patch would invoke the server properly, passing
project-specific cache directory for the program to use. I use
`xdg-cache-home' to determine what directory to use, but didn't want to
load it at the top of the file. Are there any strong opinions on that
question?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] Fix invocation of Java Language Server --]
[-- Type: text/x-patch, Size: 2042 bytes --]
From dae847f979084134effa256b95de7219c1d5dbf6 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Sun, 24 Mar 2024 21:26:08 +0100
Subject: [PATCH] Fix invocation of Java Language Server
* lisp/progmodes/eglot.el (eglot-server-programs): Invoke
"jdtls" with a "-data" flag, passing a project-specific cache
directory.
---
lisp/progmodes/eglot.el | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index f341428cac3..f2298b2e079 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -226,6 +226,7 @@ eglot-alternatives
when probe return (cons probe args)
finally (funcall err)))))))
+(declare-function xdg-cache-home "xdg" ())
(defvar eglot-server-programs `(((rust-ts-mode rust-mode) . ("rust-analyzer"))
((cmake-mode cmake-ts-mode) . ("cmake-language-server"))
(vimrc-mode . ("vim-language-server" "--stdio"))
@@ -264,7 +265,13 @@ eglot-server-programs
. ("gopls"))
((R-mode ess-r-mode) . ("R" "--slave" "-e"
"languageserver::run()"))
- ((java-mode java-ts-mode) . ("jdtls"))
+ ((java-mode java-ts-mode) .
+ ,(lambda (_interactive project) ;see github#1008
+ (require 'xdg)
+ (let ((cache (file-name-concat
+ (xdg-cache-home) "jdtls-cache"
+ (sha1 (project-root project)))))
+ (list "jdtls" "-data" cache))))
((dart-mode dart-ts-mode)
. ("dart" "language-server"
"--client-id" "emacs.eglot-dart"))
--
2.39.2
[-- Attachment #3: Type: text/plain, Size: 242 bytes --]
Oh and this patch uses functions that are not available in Emacs 26.3,
so it would make sense to apply my patch that adds Compat support to
Eglot first.
[0] https://github.com/joaotavora/eglot/issues/1008
--
Philip Kaludercic on icterid
next reply other threads:[~2024-03-24 20:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-24 20:34 Philip Kaludercic [this message]
2024-03-24 20:45 ` bug#69989: [PATCH] Fix invocation of Java Language Server Philip Kaludercic
2024-03-24 21:35 ` Felician Nemeth
2024-03-25 7:11 ` Philip Kaludercic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y1a78j3h.fsf@posteo.net \
--to=philipk@posteo.net \
--cc=69989@debbugs.gnu.org \
--cc=joaotavora@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.