dotfiles/mzte-nv/conf/ftplugin/java.lua

55 lines
1.3 KiB
Lua
Raw Normal View History

2022-11-13 21:10:33 +01:00
local jdtls = require "jdtls"
2022-10-24 21:50:24 +02:00
local mztenv = require("mzte_nv").jdtls
2022-10-18 23:03:39 +02:00
2022-11-13 21:10:33 +01:00
local caps = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
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-11-13 21:10:33 +01:00
jdtls.start_or_attach {
2022-10-18 23:03:39 +02:00
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,
2023-01-18 17:22:05 +01:00
extendedClientCapabilities = {
-- better progress indication in fidget.nvim
progressReportProvider = false,
},
2022-10-21 14:31:08 +02:00
},
2022-11-10 00:02:21 +01:00
on_attach = function(client, _)
-- formatting is handled by clang-format
client.server_capabilities.documentFormattingProvider = false
2023-01-17 15:07:16 +01:00
-- java lsp has shit highlights
client.server_capabilities.semanticTokensProvider = false
2022-11-13 21:10:33 +01:00
require("jdtls.setup").add_commands()
jdtls.setup_dap {
hotcodereplace = "auto",
}
2022-11-10 00:02:21 +01:00
end,
2022-10-18 23:03:39 +02:00
}