Fix jdtls config for neovim
parent
9d0240d292
commit
80a2dfa179
|
@ -27,25 +27,11 @@ function M.setup()
|
|||
local root_dir = require('jdtls.setup').find_root(root_markers)
|
||||
local home = os.getenv('HOME')
|
||||
|
||||
local capabilities = {
|
||||
workspace = {
|
||||
configuration = true
|
||||
},
|
||||
textDocument = {
|
||||
completion = {
|
||||
completionItem = {
|
||||
snippetSupport = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
local workspace_folder = home .. "/.workspace" .. vim.fn.fnamemodify(root_dir, ":p:h:t")
|
||||
local config = {
|
||||
flags = {
|
||||
allow_incremental_sync = true,
|
||||
};
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
}
|
||||
config.settings = {
|
||||
|
@ -65,47 +51,14 @@ function M.setup()
|
|||
end
|
||||
|
||||
local extendedClientCapabilities = require'jdtls'.extendedClientCapabilities
|
||||
extendedClientCapabilities.resolveAdditionalTextEditsSupport = true
|
||||
config.init_options = {
|
||||
-- bundles = bundles;
|
||||
extendedClientCapabilities = extendedClientCapabilities;
|
||||
}
|
||||
extendedClientCapabilities.resolveAdditionalTextEditsSupport = true
|
||||
config.init_options = {
|
||||
-- bundles = bundles;
|
||||
extendedClientCapabilities = extendedClientCapabilities;
|
||||
}
|
||||
|
||||
-- UI
|
||||
local finders = require'telescope.finders'
|
||||
local sorters = require'telescope.sorters'
|
||||
local actions = require'telescope.actions'
|
||||
local pickers = require'telescope.pickers'
|
||||
require('jdtls.ui').pick_one_async = function(items, prompt, label_fn, cb)
|
||||
local opts = {}
|
||||
pickers.new(opts, {
|
||||
prompt_title = prompt,
|
||||
finder = finders.new_table {
|
||||
results = items,
|
||||
entry_maker = function(entry)
|
||||
return {
|
||||
value = entry,
|
||||
display = label_fn(entry),
|
||||
ordinal = label_fn(entry),
|
||||
}
|
||||
end,
|
||||
},
|
||||
sorter = sorters.get_generic_fuzzy_sorter(),
|
||||
attach_mappings = function(prompt_bufnr)
|
||||
actions.select_default:replace(function()
|
||||
local selection = actions.get_selected_entry(prompt_bufnr)
|
||||
actions.close(prompt_bufnr)
|
||||
|
||||
cb(selection.value)
|
||||
end)
|
||||
|
||||
return true
|
||||
end,
|
||||
}):find()
|
||||
end
|
||||
|
||||
-- Server
|
||||
require('jdtls').start_or_attach(config)
|
||||
-- Server
|
||||
require('jdtls').start_or_attach(config)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Reference in New Issue