jdtls, enable signature by default

neovim_0.6
ray-x 3 years ago
parent 91e22f5e71
commit 90039247b4

@ -20,6 +20,8 @@ _NgConfigValues = {
code_lens_action_prompt = {enable = true, sign = true, sign_priority = 40, virtual_text = true},
treesitter_analysis = true, -- treesitter variable context
transparency = 50, -- 0 ~ 100 blur the main window, 100: fully transparent, 0: opaque, set to nil to disable it
signature_help_cfg = nil, -- if you would like to init lsp_signature plugin in navigator, pass in signature help
-- setup here. if it is nil, navigator will not init signature help
lsp = {
format_on_save = true, -- set to false to disasble lsp code format on save (if you are using prettier/efm/formater etc)
disable_format_ft = {}, -- a list of lsp not enable auto-format (e.g. if you using efm or vim-codeformat etc), empty by default

@ -230,6 +230,11 @@ local setups = {
clang = {excludeArgs = {"-frounding-math"}}
},
flags = {allow_incremental_sync = true}
},
jdtls = {
settings = {
java = {signatureHelp = {enabled = true}, contentProvider = {preferred = 'fernflower'}}
}
}
}
@ -326,6 +331,7 @@ local function wait_lsp_startup(ft, retry, user_lsp_opts)
capabilities.textDocument.completion.completionItem.resolveSupport = {
properties = {'documentation', 'detail', 'additionalTextEdits'}
}
capabilities.workspace.configuration = true
for _, client in ipairs(clients) do
if client ~= nil then
@ -410,6 +416,11 @@ local function wait_lsp_startup(ft, retry, user_lsp_opts)
end
end
end
cfg.on_init = function(client)
if client and client.config and client.config.settings then
client.notify('workspace/didChangeConfiguration', {settings = client.config.settings})
end
end
end
load_cfg(ft, lspclient, cfg, loaded)

@ -242,7 +242,11 @@ function M.setup(user_opts)
-- TODO: when active signature merge to neovim, remove this setup:
local hassig, sig = pcall(require, "lsp_signature")
if not hassig then
if hassig then
if _NgConfigValues.signature_help_cfg then
sig.setup(_NgConfigValues.signature_help_cfg)
end
else
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
require"navigator.signature".signature_handler,
{

@ -52,7 +52,14 @@ local signature_handler = mk_handler(function(err, result, ctx, config)
if config == nil then
log("config nil")
end
config = config or nil
if err then
print("signature help error: ", err, vim.inspect(result), ctx, config)
end
config = config or {}
if config.border == nil then
config.border = _NgConfigValues.border
end
if not (result and result.signatures and result.signatures[1]) then
return
end

Loading…
Cancel
Save