aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/handlers.lua
diff options
context:
space:
mode:
authorFolke Lemaitre <folke.lemaitre@gmail.com>2021-07-09 12:38:29 +0200
committerGitHub <noreply@github.com>2021-07-09 03:38:29 -0700
commit9132b76da6c22bdd96af62113ff23e408fcc2ae7 (patch)
treedcf57bfac808ff6afff527def052895c3b21908d /runtime/lua/vim/lsp/handlers.lua
parent1c416892879de6b78038f2cc2f1487eff46abb60 (diff)
downloadrneovim-9132b76da6c22bdd96af62113ff23e408fcc2ae7.tar.gz
rneovim-9132b76da6c22bdd96af62113ff23e408fcc2ae7.tar.bz2
rneovim-9132b76da6c22bdd96af62113ff23e408fcc2ae7.zip
fix(lsp): support duplicate params in signature help (#15032)
Diffstat (limited to 'runtime/lua/vim/lsp/handlers.lua')
-rw-r--r--runtime/lua/vim/lsp/handlers.lua14
1 files changed, 10 insertions, 4 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index 7da24d8c43..d39107a01f 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -329,20 +329,26 @@ M['textDocument/implementation'] = location_handler
--- - border: (default=nil)
--- - Add borders to the floating window
--- - See |vim.api.nvim_open_win()|
-function M.signature_help(_, method, result, _, bufnr, config)
+function M.signature_help(_, method, result, client_id, bufnr, config)
config = config or {}
config.focus_id = method
-- When use `autocmd CompleteDone <silent><buffer> lua vim.lsp.buf.signature_help()` to call signatureHelp handler
-- If the completion item doesn't have signatures It will make noise. Change to use `print` that can use `<silent>` to ignore
if not (result and result.signatures and result.signatures[1]) then
- print('No signature help available')
+ if config.silent ~= true then
+ print('No signature help available')
+ end
return
end
+ local client = vim.lsp.get_client_by_id(client_id)
+ local triggers = client.resolved_capabilities.signature_help_trigger_characters
local ft = api.nvim_buf_get_option(bufnr, 'filetype')
- local lines, hl = util.convert_signature_help_to_markdown_lines(result, ft)
+ local lines, hl = util.convert_signature_help_to_markdown_lines(result, ft, triggers)
lines = util.trim_empty_lines(lines)
if vim.tbl_isempty(lines) then
- print('No signature help available')
+ if config.silent ~= true then
+ print('No signature help available')
+ end
return
end
local fbuf, fwin = util.open_floating_preview(lines, "markdown", config)