lsp_signature.nvim
lsp_signature.nvim copied to clipboard
Floating window disappearing with snippets
Description
In the image below I start typing the function name, select the compe completion option from lsp. luasnip fills in the variable names for the arguments, and i can press <Tab> to move through the snippet positions.

- The floating signature initially appears while i enter the first argument.
- The floating signature disappears when i press tab to move to the second argument, and while i change it.
- I press
<Tab>again to move to the third argument, enter normal mode, then enter insert mode withcw. On entering insert mode the floating window reappears as I would expect it.
Problem
I would expect the floating window to remain while I tab through the function arguments.
When I disable luasnip and set rust-analyzer to not send argument snippets (rust-analyzer.completion.AddCallArgumentSnippets=false), the signature float works fine with the rest of my config.
Setup
- neovim 0.5
- compe,
- nvim-lspconfig
- rust-tools
I set up lsp_signature like this:
require'lsp_signature'.on_attach({
hint_enable=false,
})
I have tab configured as described here: https://github.com/hrsh7th/nvim-compe#how-to-use-tab-to-navigate-completion-menu with an alteration for working with luasnp.
-- Example of modificaiton
_G.s_tab_complete = function()
if vim.fn.pumvisible() == 1 then
return t "<C-p>"
elseif require("luasnip").jumpable(-1) then
return t "<cmd>lua require'luasnip'.jump(-1)<Cr>"
else
return t "<S-Tab>"
end
end
I saw that at the start of the video, it was showing the LSP signature. For me, it only shows it if I disable lsp snippets in clangd. Would you mind sharing your lspconfig and compe configurations?
It is kind of expected. The reason is you are in selection mode instead of insert mode when you enabled snippets I added some supports for the selection mode. But it will not the same as what I did for insert mode. Vim does not have an event for SelectionModeEnter.
It is kind of expected. The reason is you are in selection mode instead of insert mode when you enabled snippets I added some supports for the selection mode. But it will not the same as what I did for insert mode. Vim does not have an event for SelectionModeEnter.
That makes sense yes. I have this same issue with my snippets, sometimes lsp_signature will recognize them and often not. It seems to work more often with the snippets in C files than in Rust files too which is an odd observation.
Are you keeping this issue open to wait for an neovim update to Selection mode or do you think there would be a decent work-around for this?
I've ran into the same problem. I'm using vsinp as snipping engine. And popup with signature is not show when I'm in select mode inside of snippet.
It is not an ideal solution, but I added a call of vim.lsp.buf.signature_help to vsnip keymapings. This way I'm able to see popup with signature after the first jump to snipet template.
" Jump forward or backward
imap <expr> <Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)<cmd>lua vim.lsp.buf.signature_help()<cr>' : '<Tab>'
smap <expr> <Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)<cmd>lua vim.lsp.buf.signature_help()<cr>' : '<Tab>'
imap <expr> <S-Tab> vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)<cmd>lua vim.lsp.buf.signature_help()<cr>' : '<S-Tab>'
smap <expr> <S-Tab> vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)<cmd>lua vim.lsp.buf.signature_help()<cr>' : '<S-Tab>'
Thanks @antosha417 . I am not using vsnip. But this seems to be something I should add into README.
Just to be clear, signature will be shown only after you press <Tab> or <S-Tab> to navigate to another snippet placeholder.
So the very first placeholder which vsnip selects still going to be without signature while in selection mode.
As the signature only show in insert mode. I can add new mode. But it may mess up the logic. It is heavily dependent on the InsertLeave event currently. The workaround is using the keymaps mentioned in earlier post
I've ran into the same problem. I'm using vsinp as snipping engine. And popup with signature is not show when I'm in select mode inside of snippet.
It is not an ideal solution, but I added a call of
vim.lsp.buf.signature_helpto vsnip keymapings. This way I'm able to see popup with signature after the first jump to snipet template." Jump forward or backward imap <expr> <Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)<cmd>lua vim.lsp.buf.signature_help()<cr>' : '<Tab>' smap <expr> <Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)<cmd>lua vim.lsp.buf.signature_help()<cr>' : '<Tab>' imap <expr> <S-Tab> vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)<cmd>lua vim.lsp.buf.signature_help()<cr>' : '<S-Tab>' smap <expr> <S-Tab> vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)<cmd>lua vim.lsp.buf.signature_help()<cr>' : '<S-Tab>'