1
0
Fork 0

nvim: Move JDTLS config to ftplugin for Java

This commit is contained in:
coderkun 2024-10-15 11:03:18 +02:00
commit 60bd6e4b8e
2 changed files with 52 additions and 55 deletions

View file

@ -3,60 +3,7 @@ return {
dependencies = {
"williamboman/mason.nvim"
},
ft = "java",
config = function()
local jdtlsConfig = {
cmd = {'jdtls'},
on_attach = function(client, bufnr)
require('jdtls').setup_dap({hotcodereplace = 'auto'})
require('jdtls.dap').setup_dap_main_class_configs()
end,
root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1]),
init_options = {
bundles = {
vim.fn.expand("$MASON/share/java-debug-adapter/com.microsoft.java.debug.core.jar"),
vim.fn.expand("$MASON/share/java-debug-adapter/com.microsoft.java.debug.plugin.jar"),
},
},
java = {
autobuild = {
enabled = true
},
debug = {
settings = {
hotCodeReplace = 'auto'
},
},
},
settings = {
java = {
autobuild = {
enabled = true
},
debug = {
settings = {
hotCodeReplace = 'auto'
},
},
saveActions = {
organizeImports = true
},
signatureHelp = {
enabled = false,
description = {
enabled = false
},
},
format = {
enable = true,
settings = {
url = "/home/oliver/Dokumente/Gallery Systems/Products/GS Eclipse Formatter Java.xml"
},
},
},
},
}
local dap = require('dap')
dap.configurations.java = {{
type = 'java',
@ -77,7 +24,5 @@ return {
hostName = '127.0.0.1',
port = 5105,
}}
require('jdtls').start_or_attach(jdtlsConfig)
end,
}