Closed ranebrown closed 2 years ago
Seems there are something missing in your config. I do not see ultsnips in cmp pop up, also it does not expand from lsp. Thus failed to reproduce.
Also could you try without lsp_install?
Still seeing the same thing with lspinstaller removed. Here is a minimal config and steps to reproduce. Thanks for taking a look.
clangd
and have in your PATH
minimal_init.lua
and test.cpp
nvim -u minimal_init.lua
-> wait for install of plugins and treesitter then :quit
nvim -u minimal_init.lua test.cpp
floating_window = false
and it works as expectedI also noticed that after expanding the snippet the signature window appears and then disappears and then comes back up after typing the first value. Not sure if that is related to the problem.
Should also note that the same behavior is present without "quangnguyen30192/cmp-nvim-ultisnips"
and the associated mappings but in that case you need to set/use the Ultisnip key maps for jumping between placeholders.
I would say it is an upstream issue. ultisnip can not handle floating windows/buffer of neovim The here from ultisnips:
class TabStop(EditableTextObject):
"""See module docstring."""
def __init__(self, parent, token, start=None, end=None):
if start is not None:
self._number = token
EditableTextObject.__init__(self, parent, start, end)
else:
self._number = token.number
EditableTextObject.__init__(self, parent, token)
parent._tabstops[self._number] = self # pylint:disable=protected-access
This object was created multiple times when signature floating windows popup up. I think ultisnip trying to create a tabstop object for each buffer, but when you press <Tab>
, it failed to use correct tabstop object and the one it choosen is empty. Thus you can not jump from one placeholder to next.
@sirver, @hrsh7th do either of you mind taking a look at this? I'm happy to open an issue in the correct repo but not sure where the problem stems from. Thanks!
I think it caused by neovim itself. https://github.com/neovim/neovim/blob/master/runtime/lua/vim/lsp/util.lua#L970
The neovim doesn't specify the noautocmd: true
. (maybe)
Adding noautocmd = true,
in that file does seem to fix the problem. Is that an additional option that can be passed when the signature floating window is created or does it really need to be the default set by neovim?
Thanks for figuring this out. Putting this in init.lua
should fix it without the need to modify neovim's files.
local old_make_floating = vim.lsp.util.make_floating_popup_options
if not old_make_floating(0, 0, {}).noautocmd then
vim.lsp.util.make_floating_popup_options = function(width, height, opts)
local ret = old_make_floating(width, height, opts)
ret.noautocmd = true
return ret
end
end
@ranebrown @Bahex I updated the plugin for this. Could you check if latest version works for you
@ray-x Works as expected :+1:
When setting
floating_window = true
and using an LSP provided snippet it is not possible to jump between argument placeholders. Works as expected when set to false. See https://github.com/quangnguyen30192/cmp-nvim-ultisnips/issues/13 for more detail and minimal config to reproduce.