45 lines
1.2 KiB
Lua
45 lines
1.2 KiB
Lua
local T = require('toolchain')
|
|
local M = {}
|
|
|
|
function M.setup()
|
|
T.add_highlighter_autoinstalls('java', 'kotlin')
|
|
T.add_lsps(function(lspconfig, capabilities)
|
|
local paths = vim.fn.systemlist(
|
|
"update-alternatives --display java | grep '^/.*$' | cut -d ' ' -f 1"
|
|
)
|
|
local runtimes = {}
|
|
for _, path in ipairs(paths) do
|
|
local version = vim.fn.matchstr(path, '\\v\\d+(\\.\\d+)*')
|
|
table.insert(runtimes, {
|
|
name = version,
|
|
path = path,
|
|
})
|
|
end
|
|
lspconfig.jdtls.setup({
|
|
capabilities = capabilities,
|
|
settings = {
|
|
java = {
|
|
configuration = {
|
|
runtimes = runtimes,
|
|
},
|
|
},
|
|
},
|
|
})
|
|
end)
|
|
|
|
T.add_plugins({
|
|
'nvim-java/nvim-java',
|
|
config = function()
|
|
require('java').setup({
|
|
notifications = {
|
|
dap = false,
|
|
},
|
|
jdk = {
|
|
auto_install = false,
|
|
},
|
|
})
|
|
end,
|
|
})
|
|
end
|
|
|
|
return M
|