Extensions for the built-in Language Server Protocol support in Neovim (>= 0.11.0) for kotlin-lsp.
- Decompile and open class file contents using kotlin-lsp
decompile
command - Export workspace to JSON using kotlin-lsp
exportWorkspace
command - Support for custom JVM arguments
- Support kotlin-lsp installation from Mason
Install the plugin with your package manager:
{
"AlexandrosAlexiou/kotlin.nvim",
ft = { "kotlin" },
config = function()
require("kotlin").setup {
-- Optional: Specify root markers for multi-module projects
root_markers = {
"gradlew",
".git",
"mvnw",
"settings.gradle",
},
-- Optional: Specify a custom Java path to run the server
jre_path = os.getenv("JDK21"),
-- Optional: Specify additional JVM arguments
jvm_args = {
"-Xmx4g",
},
}
end,
},
You can easily install kotlin-lsp using Mason with the following command:
:MasonInstall kotlin-lsp
Caution
If you use other tools like nvim-lspconfig or mason-lspconfig, make sure to explicitly exclude the kotlin_lsp
configuration there to avoid conflicts.
There is no need to follow the manual installation steps from the upstream guide. Mason will handle everything for you.