ray-x / lsp_signature.nvim

LSP signature hint as you type
Apache License 2.0
2.07k stars 57 forks source link

Lsp-signature prefix does not goes away #94

Closed theSafdarAwan closed 2 years ago

theSafdarAwan commented 3 years ago

Screenshot_2021-09-05_16-39-38

kristijanhusak commented 3 years ago

This also happens to me randomly, but also the signature popup is visible. I'm here in normal mode, cursor is just not visible on screenshot:

screenshot

I'm just not sure how to reproduce it 100%.

Some additional info:

sQVe commented 3 years ago

I'm getting this too frequently. Enough for it to be very annoying.

Running nvim-cmp.

I'd love to help debug and solve this, just ping what information you need.

ray-x commented 3 years ago

I would suspect it is a issue that InsertLeave event was not trigger/missed. But not sure is it a defect from neovim or from the plugin. I am working on code cleanup this week. And will back to this once I finished.

naripok commented 3 years ago

This also happens to me randomly, but also the signature popup is visible

This happens to me (every time) whenever I open a function parenthesis and leave insert mode before the signature popup shows. The pop will get stuck and the only two ways to close it is to enter insert mode again inside the parenthesis and exit or to call lua vim.lsp.buf.signature_help(). I'm also using nvim-cmp and lspconfig. Please, let me know if I can help with more info for debugging or anything else, really. :)

EDIT Included a gif, for clarity. It shows the preview window being opened after exiting insert mode and getting stuck, not closing on CursorMoved. At the end of the gif I issue a vim.lsp.buf.signature_help() somewhere else, which closes the pervious window and gets closed on CursorMoved.

Peek 2021-09-15 13-13

I think it takes so long to open because the python lsp response to the signature query is slow, and maybe the problem is a race condition where the vim.lsp.util.close_preview_autocmd() callback is called before the actual preview windows get created, so the window reference passed to close_preview_autocmd second argument is not the correct ref to the window? Just some thoughts, I haven't studied the code yet. Maybe that is not the problem at all since the signature hint gets stuck too and it is not a preview window...

btw, my nvim --version output, if it helps:

nvim --version
NVIM v0.5.0
Build type: Release
LuaJIT 2.1.0-beta3
megalithic commented 3 years ago

Can confirm that I'm still getting this behaviour too.

NVIM v0.6.0-dev+397-gc7a63f35d
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by <me>

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/home/linuxbrew/.linuxbrew/Cellar/neovim/HEAD-c7a63f3/share/nvim"

settings:

    require("lsp_signature").on_attach({
        bind = true, -- This is mandatory, otherwise border config won't get registered.
        floating_window = true,
        floating_window_above_cur_line = true, -- try to place the floating above the current line
        -- floating_window_off_y = 1, -- adjust float windows y position. allow the pum to show a few lines
        -- fix_pos = true,
        hint_enable = false,
        decorator = { "`", "`" },
        handler_opts = {
            border = "double",
        },
    })
ray-x commented 3 years ago

What is your function signature?

ErikReider commented 3 years ago

I've noticed this too... When pasting a method in insert mode -> move cursor to end of method parenthesis -> ^C -> :w.

danielgatis commented 2 years ago

same here! :(

ray-x commented 2 years ago

I did not see this happen for a while. I am using gopls, tsserver and pyright Please check if it goes away by disabling autopair plugins or any similar plugins (or, maybe check my setup ray-x/nvim regarding how to setup autopir). Please post your language server, your function signature and your lsp_signature config. Also, a walk around is define the toggle key to toggle the floating window.

theSafdarAwan commented 2 years ago

sorry i found what was causing it if you use (ctrl+c) to get out of the insert mode then use <c-[> this thing wont happen again and also if ctrl+c is you habbit then set inoremap

shlomocarmeter commented 2 years ago

Had the same problem. Setting inoremap (ctrl+c) to (esc) fixed this for me. Thanks @imSafdarAwan!

ray-x commented 2 years ago

<ctrl-c> will trigger InsertLeave event on which signature is hooked on. So the plugin has no idea you are not in Normal mode and should close the popup.

andriati-alex commented 2 years ago

Thanks guys I really liked the plugin and was facing the same problem exiting with <ctrl-c>

ray-x commented 2 years ago

Sorry. I was doing some refactoring in the last few days. Pushed a change to master. Hope it works.

druskus20 commented 2 years ago

It seems to work! Thanks!