2021-07-08 18:35:41 +02:00
|
|
|
if require("lv-utils").check_lsp_client_active "jdtls" then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2021-07-05 03:14:01 +02:00
|
|
|
local util = require "lspconfig/util"
|
2021-03-16 04:11:39 +01:00
|
|
|
-- 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'}}
|
2021-06-26 19:15:02 +02:00
|
|
|
-- 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
|
|
|
|
2021-06-26 19:15:02 +02: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)
|
2021-07-05 03:14:01 +02:00
|
|
|
-- require('jdtls').setup_dap()
|
|
|
|
require("lsp").common_on_attach(client, bufr)
|
2021-03-23 03:10:39 +01:00
|
|
|
end
|
|
|
|
|
2021-07-05 03:14:01 +02:00
|
|
|
require("lspconfig").jdtls.setup {
|
|
|
|
on_attach = on_attach,
|
|
|
|
cmd = { DATA_PATH .. "/lspinstall/java/jdtls.sh" },
|
|
|
|
filetypes = { "java" },
|
|
|
|
root_dir = util.root_pattern { ".git", "build.gradle", "pom.xml" },
|
|
|
|
-- init_options = {bundles = bundles}
|
|
|
|
-- on_attach = require'lsp'.common_on_attach
|
2021-06-26 19:15:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
-- require('jdtls').start_or_attach({
|
|
|
|
-- on_attach = on_attach,
|
|
|
|
-- cmd = {DATA_PATH .. "/lspinstall/java/jdtls.sh"},
|
|
|
|
-- root_dir = require('jdtls.setup').find_root({'build.gradle', 'pom.xml', '.git'}),
|
|
|
|
-- init_options = {bundles = bundles}
|
|
|
|
-- })
|
2021-07-01 00:45:40 +02:00
|
|
|
|
|
|
|
-- TODO setup autoformat stuff later
|
2021-07-05 03:14:01 +02:00
|
|
|
-- _java = {
|
|
|
|
-- -- {'FileType', 'java', 'luafile '..CONFIG_PATH..'/lua/lsp/java-ls.lua'},
|
|
|
|
-- {
|
|
|
|
-- 'FileType', 'java',
|
|
|
|
-- 'nnoremap ca <Cmd>lua require(\'jdtls\').code_action()<CR>'
|
|
|
|
-- }
|
|
|
|
-- }
|