diff --git a/README.md b/README.md index c19b9741..a11f7cdf 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,35 @@ 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-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 - Checkout this repository