From 7c592caa9e8534cfa22ed6d688259697c5ffa433 Mon Sep 17 00:00:00 2001 From: Alessandro Bertulli Date: Sun, 19 Oct 2025 15:19:14 +0200 Subject: [PATCH 1/2] Add basic Emacs configuration instructions --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index c19b9741..77cca1a3 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,20 @@ A Java [language server](https://github.com/Microsoft/vscode-languageserver-prot Note: This tool is not compatible with [vim-lsp](https://github.com/prabirshrestha/vim-lsp) as it only supports LSPv2.0. +### Emacs (with Eglot) + +- Checkout this repository +- Run `./scripts/download_{linux|mac|windows}.sh` +- Run `./scripts/link_{linux|mac|windows}.sh` +- Run `mvn package -DskipTests` +- In Emacs 29+, Eglot is built-in, otherwise you can install it with `M-x package-install eglot` +- Add this configuration to your Emacs init file: + ```emacs-lisp + (add-to-list 'eglot-server-programs '(java-mode . ("/java-language-server/dist/lang_server_{linux|mac|windows}.sh"))) + (add-hook 'java-mode-hook #'eglot-ensure) + ``` + + ### KDE Kate - Checkout this repository From d76654dbab0e429b9c9527da6b00b312d9a7939a Mon Sep 17 00:00:00 2001 From: Alessandro Bertulli Date: Sat, 6 Dec 2025 13:42:39 +0100 Subject: [PATCH 2/2] Add clarification about new Eglot default integration --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 77cca1a3..a11f7cdf 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,24 @@ Note: This tool is not compatible with [vim-lsp](https://github.com/prabirshrest - In Emacs 29+, Eglot is built-in, otherwise you can install it with `M-x package-install eglot` - Add this configuration to your Emacs init file: ```emacs-lisp - (add-to-list 'eglot-server-programs '(java-mode . ("/java-language-server/dist/lang_server_{linux|mac|windows}.sh"))) (add-hook 'java-mode-hook #'eglot-ensure) ``` +- For older Eglot versions (<= 1.12.29), you'll also need: + ```emacs-lisp + (add-to-list 'eglot-server-programs '(java-mode . ("/dist/lang_server_{linux|mac|windows}.sh"))) + ``` + + Alternatively, for newer versions (>= 1.19), it is sufficient to have a script called `java-language-server` in your `PATH` that launches the actual server. In Linux, this can be done for instance by creating a script in `/usr/local/bin`: + ```bash + sudo bash -c 'cat << EOF > /usr/local/bin/java-language-server + #! /bin/sh + + /dist/lang_server_linux.sh + EOF' + + sudo chmod +x /usr/local/bin/java-language-server + ``` + MacOS and Windows should work similarly. ### KDE Kate