ray-x / lsp_signature.nvim

LSP signature hint as you type
Apache License 2.0
1.98k stars 53 forks source link

fix: cursor position outside buffer error #294

Closed kair8m closed 7 months ago

kair8m commented 8 months ago

Bugfix: Cursor Position Error in lsp_signature Plugin during Parameter Input

Description

Under Neovim 0.9.4, the lsp_signature plugin encountered a critical error when typing parameters inside a function, resulting in the following error:

Error executing vim.schedule lua callback: ...vim/lazy/lsp_signature.nvim/lua/lsp_signature/helper.lua:677: Cursor position outside buffer
stack traceback:
    [C]: in function 'nvim_win_set_cursor'
    ...vim/lazy/lsp_signature.nvim/lua/lsp_signature/helper.lua:677: in function 'highlight_parameter'
    .../nvim/lazy/lsp_signature.nvim/lua/lsp_signature/init.lua:618: in function 'handler'
    ...bob/v0.9.4/nvim-macos/share/nvim/runtime/lua/vim/lsp.lua:1393: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>

Changes Made

kair8m commented 8 months ago

I had to add changes that are not relevant to this PR (removed unused variable) because of CI

ray-x commented 8 months ago

why would line == 1(noice +nvim 0.9.x in your case) but cursor failed to jump to line 2. It's a bit strange. I am ok with the changes and thank you for your PR. Just need to figure out why it broke in your side. Could you elaberate a bit more on how to reproduce the issue.