add: disable jdtls if nvim-jdtls active

This commit is contained in:
asep.komarudin 2024-06-28 19:29:01 +07:00
parent 524bfc707b
commit e009cbb877
4 changed files with 25 additions and 16 deletions

View file

@ -62,20 +62,22 @@ return {
end,
},
},
opts = function()
opts = function(_, opts)
opts.skip_config = opts.skip_config or {}
opts.ensure_installed = opts.ensure_installed or {}
local servers = { "lua_ls" }
local mason_install = pcode.mason_ensure_installed or {}
local unregis_lsp = pcode.unregister_lsp or {}
vim.list_extend(servers, mason_install)
return {
ensure_installed = servers,
automatic_installation = true,
}
vim.list_extend(opts.ensure_installed, servers)
vim.list_extend(opts.skip_config, unregis_lsp)
opts.automatic_installation = true
return opts
end,
config = function(_, opts)
require("mason-lspconfig").setup(opts)
local option = {}
local unregis_lsp = pcode.unregister_lsp or {}
require("mason-lspconfig").setup_handlers({
function(server_name) -- default handler (optional)
local capabilities = require("user.lsp.handlers").capabilities
@ -83,7 +85,7 @@ return {
capabilities.offsetEncoding = { "utf-16" }
end
local is_skip = false
local my_index = idxOf(unregis_lsp, server_name)
local my_index = idxOf(opts.skip_config, server_name)
if my_index ~= nil then
is_skip = true
end

View file

@ -17,6 +17,13 @@ end
if pcode.active_java_config.active then
M = {
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.skip_config = opts.skip_config or {}
vim.list_extend(opts.skip_config, { "jdtls" })
end,
},
{
"mfussenegger/nvim-jdtls",
ft = java_filetypes,
@ -248,7 +255,7 @@ if pcode.active_java_config.active then
},
},
{
"simrat39/symbols-outline.nvim",
"rockerBOO/symbols-outline.nvim",
cmd = "SymbolsOutline",
config = function()
require("symbols-outline").setup({

View file

@ -110,11 +110,11 @@ if pcode.active_cpp_config then
pcode.nvim_dap = true
end
-- run if java config true
if pcode.active_java_config.active and pcode.active_java_config.use_nvim_jdtls then
-- table.insert(pcode.treesitter_ensure_installed, "java")
-- table.insert(pcode.mason_ensure_installed, "jdtls")
-- table.insert(pcode.null_ls_ensure_installed, "google_java_format")
-- table.insert(pcode.dap_ensure_installed, "javadbg")
table.insert(pcode.unregister_lsp, "jdtls")
end
-- if pcode.active_java_config.active and pcode.active_java_config.use_nvim_jdtls then
-- table.insert(pcode.treesitter_ensure_installed, "java")
-- table.insert(pcode.mason_ensure_installed, "jdtls")
-- table.insert(pcode.null_ls_ensure_installed, "google_java_format")
-- table.insert(pcode.dap_ensure_installed, "javadbg")
-- table.insert(pcode.unregister_lsp, "jdtls")
-- end
return {}