A tiny neovim plugin that provides an alternate textDocument/signatureHelp
request handler that displays every signature returned by the language server.
This is helpful in languages that support function overloading, such as C++.
This should be usable in any language, as when only one signature is available, the behavior should match the built-in default vim.lsp.handlers.signature_help
.
Every signature visible:
Only viable signature visible:
C++23 std::print
with signature numbering enabled:
With neovim 0.10
, signatures are surrounded by empty lines. This should be fixed when vertical conceal is implemented.
require('everysig').setup(options)
The options
table may contain the following keys:
- override: boolean (default false), whether to override the default signature help handler.
- silent: boolean (default false), whether to silence
"No signature help available"
notifications. - number: boolean (default false), whether to append number comments to displayed signatures.
Example plugin spec for lazy.nvim:
{
'aattoa/nvim-everysig',
opts = { override = true }, -- Options passed to `setup`.
lazy = true, -- Lazy-load the plugin ...
event = 'LspAttach', -- ... when an LSP client attaches to a buffer.
}
If overridden, the signature help request is triggered with the usual vim.lsp.buf.signature_help
. For example, to get signature help with ctrl+space in normal mode and insert mode:
vim.keymap.set({ 'n', 'i' }, '<C-Space>', vim.lsp.buf.signature_help)
The signature help handler can be accessed without any setup.
For example, manually override the default handler, which is equivalent to setup({ override = true })
:
vim.lsp.handlers['textDocument/signatureHelp'] = require('everysig').signature_help_handler