dotfiles/.config/nvim/ftplugin/java.lua

38 lines
814 B
Lua
Raw Normal View History

2022-10-18 23:03:39 +02:00
local caps = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
2022-10-24 21:50:24 +02:00
local mztenv = require("mzte_nv").jdtls
2022-10-18 23:03:39 +02:00
2022-10-24 21:50:24 +02:00
local bundle_info = mztenv.getBundleInfo()
local dirs = mztenv.getDirs()
2022-10-21 14:31:08 +02:00
2022-10-18 23:03:39 +02:00
require("jdtls").start_or_attach {
cmd = {
"jdtls",
"-configuration",
2022-10-24 21:50:24 +02:00
dirs.config,
2022-10-18 23:03:39 +02:00
"-data",
2022-10-24 21:50:24 +02:00
dirs.workspace,
2022-10-18 23:03:39 +02:00
},
capabilities = caps,
2022-10-21 14:31:08 +02:00
root_dir = require("jdtls.setup").find_root {
".git",
"mvnw",
"gradlew",
"build.gradle",
},
2022-10-18 23:03:39 +02:00
settings = {
java = {
configuration = {
2022-10-24 21:50:24 +02:00
runtimes = mztenv.findRuntimes(),
2022-10-18 23:03:39 +02:00
},
2022-10-21 14:31:08 +02:00
contentProvider = bundle_info.content_provider,
2022-10-18 23:03:39 +02:00
},
},
2022-10-21 14:31:08 +02:00
init_options = {
bundles = bundle_info.bundles,
},
2022-10-18 23:03:39 +02:00
}