LunarVim/lua/lsp/java-ls.lua

32 lines
1,014 B
Lua
Raw Normal View History

-- In Vimscript
-- augroup lsp
-- au!
-- au FileType java lua require('jdtls').start_or_attach({cmd = {'java-linux-ls'}})
-- augroup end
-- find_root looks for parent directories relative to the current buffer containing one of the given arguments.
-- require'lspconfig'.jdtls.setup {cmd = {'java-linux-ls'}}
if vim.fn.has("mac") == 1 then
JAVA_LS_EXECUTABLE = 'java-mac-ls'
elseif vim.fn.has("unix") == 1 then
JAVA_LS_EXECUTABLE = 'java-linux-ls'
else
print("Unsupported system")
end
2021-03-23 03:10:39 +01:00
local bundles = {
vim.fn.glob(
CONFIG_PATH.."/.debuggers/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar")
2021-03-23 03:10:39 +01:00
};
local on_attach = function(client, bufr)
require('jdtls').setup_dap()
require'lsp'.common_on_attach(client, bufr)
end
2021-03-17 20:48:52 +01:00
require('jdtls').start_or_attach({
2021-03-23 03:10:39 +01:00
on_attach = on_attach,
2021-03-17 20:48:52 +01:00
cmd = {JAVA_LS_EXECUTABLE},
2021-03-23 03:10:39 +01:00
root_dir = require('jdtls.setup').find_root({'build.gradle', 'pom.xml', '.git'}),
init_options = {bundles = bundles}
2021-03-17 20:48:52 +01:00
})