Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cursor position outside buffer error #294

Merged
merged 2 commits into from
Nov 26, 2023

Conversation

kair8m
Copy link
Contributor

@kair8m kair8m commented Nov 14, 2023

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

  • Addressed the cursor position error during parameter input inside a function in the lsp_signature plugin.
  • Wrapped the problematic function call in helper.lua within a protected call to ignore errors, preventing the plugin from throwing an exception for cursor position outside the buffer.

@kair8m
Copy link
Contributor Author

kair8m commented Nov 14, 2023

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

@ray-x
Copy link
Owner

ray-x commented Nov 14, 2023

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.

@kair8m kair8m force-pushed the feature/fix-cursor-position-outside-buffer branch from c4f171f to fcca337 Compare November 25, 2023 01:50
Copy link
Owner

@ray-x ray-x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ray-x ray-x merged commit bd50289 into ray-x:master Nov 26, 2023
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants