The config may work but is not guaranteed to work with future versions of Neovim or nvim-jdtls, the plugins are pinned to stable tested versions.
-
Make sure you have Java 11 or greater installed, you will also need
npm
installed for the testing bundle -
Install jdtls
Open update Neovim and install jdtls
:LspInstall jdtls
- Install java-debug
git clone https://github.com/microsoft/java-debug ~/.config/nvim/java-debug
cd ~/.config/nvim/java-debug
./mvnw clean install
- Install vscode-java-test
git clone https://github.com/microsoft/vscode-java-test.git ~/.config/nvim/vscode-java-test
cd ~/.config/nvim/vscode-java-test
npm install
npm run build-plugin
- Choose your formatter
You can choose to continue to use google-java-format
, which is preconfigured for this but you will need to install it.
You can read more about it here: google-java-format
-
Mac:
brew install google-java-format
-
Arch:
paru -S google-java-format
Alternatively you can use the formatter builtin with jdtls
by:
-
Removing this line: null-ls formatter
-
Setting
jdtls
formatter to true here -
Removing or setting this line to
true
here
For a better understanding of how this works and to keep updated with the project make sure to checkout the nvim-jdtls repository.
-
General: keybindings
-
LSP: keybindings
-
Java Specific: keybindings