You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
4.5 KiB

require('lspconfig')['jdtls'].setup {
on_attach = on_attach,
flags = lsp_flags,
-- Server-specific settings...
settings = {
["jdtls"] = {
-- The command that starts the language server
-- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line
autostart = true,
-- autostart = false,
cmd = {
-- 💀
'java', -- or '/path/to/java17_or_newer/bin/java'
-- depends on if `java` is in your $PATH env variable and if it points to the right version.
'-Declipse.application=org.eclipse.jdt.ls.core.id1',
'-Dosgi.bundles.defaultStartLevel=4',
'-Declipse.product=org.eclipse.jdt.ls.core.product',
'-Dlog.protocol=true', '-Dlog.level=ALL', '-Xms1g',
'--add-modules=ALL-SYSTEM', '--add-opens',
'java.base/java.util=ALL-UNNAMED', '--add-opens',
'java.base/java.lang=ALL-UNNAMED', -- 💀
'-jar',
'/Users/nige/.local/share/lsp/jdtls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar',
-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
-- Must point to the Change this to
-- eclipse.jdt.ls installation the actual version
-- 💀
'-configuration',
'/Users/nige/.local/share/lsp/jdtls/config_mac',
-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^
-- Must point to the Change to one of `linux`, `win` or `mac`
-- eclipse.jdt.ls installation Depending on your system.
-- 💀
'-data', '/Users/nige/.config/jdtls_workspaces/' ..
vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t')
},
-- 💀
-- This is the default if not provided, you can remove it. Or adjust as needed.
-- One dedicated LSP server & client will be started per unique root_dir
root_dir = require('jdtls.setup').find_root({
'.git', 'mvnw', 'gradlew'
}),
-- 💀
-- This is the default if not provided, you can remove it. Or adjust as needed.
-- One dedicated LSP server & client will be started per unique root_dir
-- Here you can configure eclipse.jdt.ls specific settings
-- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request
-- for a list of options
settings = {
java = {
eclipse = { downloadSources = true },
maven = { downloadSources = true },
implementationsCodeLens = { enabled = true },
referencesCodeLens = { enabled = true },
references = { includeDecompiledSources = true }
}
},
-- Language server `initializationOptions`
-- You need to extend the `bundles` with paths to jar files
-- if you want to use additional eclipse.jdt.ls plugins.
--
-- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation
--
-- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this
init_options = {
extendedClientCapabilities = { classFileContentsSupport = true },
bundles = {
vim.fn.glob(
"/Users/nige/.local/share/nvim/dap-servers/com.microsoft.java.debug.plugin_0.43.0.jar",
1)
}
},
on_attach = function(client, bufnr)
-- With `hotcodereplace = 'auto' the debug adapter will try to apply code changes
-- you make during a debug session immediately.
-- Remove the option if you do not want that.
-- You can use the `JdtHotcodeReplace` command to trigger it manually
-- require('jdtls').setup_dap({ hotcodereplace = 'auto' })
local jdtls = require('jdtls')
jdtls.setup_dap({ hotcodereplace = 'auto' })
jdtls.setup.add_commands()
end
}
}
}