diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index b955f8ebf8..72a2e01da0 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1845,7 +1845,12 @@ selection_range({direction}) *vim.lsp.buf.selection_range()* signature_help({config}) *vim.lsp.buf.signature_help()* Displays signature information about the symbol under the cursor in a - floating window. + floating window. Allows cycling through signature overloads with ``, + which can be remapped via `(nvim.lsp.ctrl-s)` + + Example: >lua + vim.keymap.set('n', '', '(nvim.lsp.ctrl-s)') +< Parameters: ~ • {config} (`vim.lsp.buf.signature_help.Opts?`) See diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index f07c6a5132..1aba0d8738 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -345,7 +345,15 @@ local sig_help_ns = api.nvim_create_namespace('nvim.lsp.signature_help') --- @field silent? boolean --- Displays signature information about the symbol under the cursor in a ---- floating window. +--- floating window. Allows cycling through signature overloads with ``, +--- which can be remapped via `(nvim.lsp.ctrl-s)` +--- +--- Example: +--- +--- ```lua +--- vim.keymap.set('n', '', '(nvim.lsp.ctrl-s)') +--- ``` +--- --- @param config? vim.lsp.buf.signature_help.Opts function M.signature_help(config) local method = ms.textDocument_signatureHelp @@ -420,12 +428,18 @@ function M.signature_help(config) local fbuf, fwin = show_signature() if can_cycle then - vim.keymap.set('n', '', function() + vim.keymap.set('n', '(nvim.lsp.ctrl-s)', function() show_signature(fwin) end, { buffer = fbuf, desc = 'Cycle next signature', }) + if vim.fn.hasmapto('(nvim.lsp.ctrl-s)', 'n') == 0 then + vim.keymap.set('n', '', '(nvim.lsp.ctrl-s)', { + buffer = fbuf, + desc = 'Cycle next signature', + }) + end end end) end