26 lines
606 B
Lua
26 lines
606 B
Lua
return {
|
|
"mfussenegger/nvim-jdtls",
|
|
opts = {
|
|
cmd = { "jdtls" },
|
|
},
|
|
ft = { "java" },
|
|
cond = function(_)
|
|
return vim.fn.executable("jdtls") ~= 0
|
|
and vim.fn.executable("python3") ~= 0
|
|
end,
|
|
config = function(_, opts)
|
|
if (opts.root_dir == nil) then
|
|
opts.root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1])
|
|
end
|
|
|
|
vim.api.nvim_create_autocmd({ "FileType" }, {
|
|
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
|
callback = function(ev)
|
|
if (ev.match == "java") then
|
|
require("jdtls").start_or_attach(opts)
|
|
end
|
|
end,
|
|
})
|
|
end,
|
|
}
|