java-lsp: fix small bug

This commit is contained in:
kossLAN 2024-08-29 15:03:41 -04:00
parent 1f51668236
commit e1061ee305
Signed by: kossLAN
SSH key fingerprint: SHA256:bdV0x+wdQHGJ6LgmstH3KV8OpWY+OOFmJcPcB0wQPV8
2 changed files with 18 additions and 1 deletions

16
nvim/ftplugin/java.lua Normal file
View file

@ -0,0 +1,16 @@
-- Exit if the language server isn't available
if vim.fn.executable('java-language-server') ~= 1 then
return
end
local root_files = {
'.git',
'Main.java',
}
vim.lsp.start {
name = 'java_language_server',
cmd = { 'java-language-server' },
root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]),
capabilities = require('user.lsp').make_client_capabilities(),
}