mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
fix: PR#1300
This commit is contained in:
parent
69f5a30af8
commit
ebc5375401
1 changed files with 23 additions and 25 deletions
|
|
@ -44,7 +44,6 @@ return {
|
|||
{
|
||||
"mfussenegger/nvim-jdtls",
|
||||
dependencies = { "folke/which-key.nvim" },
|
||||
ft = { "java" },
|
||||
config = function()
|
||||
-- The configuration for jdtls contains two useful items:
|
||||
-- 1. The list of filetypes on which to match.
|
||||
|
|
@ -72,6 +71,11 @@ return {
|
|||
end
|
||||
end
|
||||
|
||||
-- Attach jdtls for the proper filetypes (i.e. java).
|
||||
-- Existing server will be reused if the root_dir matches.
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = filetypes,
|
||||
callback = function()
|
||||
local fname = vim.api.nvim_buf_get_name(0)
|
||||
local root_dir = find_java_project_root(fname)
|
||||
local project_name = root_dir and vim.fs.basename(root_dir)
|
||||
|
|
@ -94,14 +98,8 @@ return {
|
|||
-- enable CMP capabilities
|
||||
capabilities = require("cmp_nvim_lsp").default_capabilities(),
|
||||
}
|
||||
|
||||
-- Attach jdtls for the proper filetypes (i.e. java).
|
||||
-- Existing server will be reused if the root_dir matches.
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = filetypes,
|
||||
callback = function()
|
||||
local jdtls_opts = require("lazyvim.util").opts("nvim-jdtls")
|
||||
require("jdtls").start_or_attach(vim.tbl_deep_extend("force", jdtls_opts or {}, jdtls_base_config))
|
||||
require("jdtls").start_or_attach(vim.tbl_deep_extend("force", jdtls_base_config, jdtls_opts or {}))
|
||||
-- not need to require("jdtls.setup").add_commands(), start automatically adds commands
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue