trouble.nvim
trouble.nvim copied to clipboard
Cursor position outside buffer when opening Trouble
Description
Run into this issue when opening with :Trouble
or navigating to the trouble window after it's been opened:
|| Error executing vim.schedule lua callback: ...site/pack/packer/start/trouble.nvim/lua/trouble/view.lua:453: Cursor position outside buffer
|| stack traceback:
|| [C]: in function 'nvim_win_set_cursor'
|| ...site/pack/packer/start/trouble.nvim/lua/trouble/view.lua:453: in function ''
|| vim.lua: in function <vim.lua:0>
Environment details
Trouble config:
require("trouble").setup {
auto_open = true,
auto_close = true
}
Neovim version info:
NVIM v0.7.0-dev+836-g55a59e56e
Build type: Release
LuaJIT 2.1.0-beta3
same error
I'm getting the same error.
I'm also having this error.
Any luck finding a root cause of this issue? Getting this when I open trouble on a Scala file with nvim-metals attached.
~Also having this issue.~
edit: error on my part, the path to the file with diagnostic errors was incorrect due to an error in the linters’ configuration
I experienced this error in February 2022, I remember that a day later it disappeared. The only advice I can give is to look at the README, maybe you have to update some configuration, update the plugin, I don't know if the version of Neovim you are using has something to do with it.
I'm seeing this too:
Error executing vim.schedule lua callback: ...site/pack/packer/start/trouble.nvim/lua/trouble/view.lua:469: Cursor position outside buffer
stack traceback:
[C]: in function 'nvim_win_set_cursor'
...site/pack/packer/start/trouble.nvim/lua/trouble/view.lua:469: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
Running the latest Neovim from HomeBrew: neovim--0.8.3.arm64_ventura.bottle.tar.gz. I've also checked I'm running the latest versions of all the plugins... Does anyone have an idea what this might be?
Same issue, trouble version "67337644e38144b444d026b0df2dc5fa0038930f", neovim version:
NVIM v0.8.3
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by runner@fv-az183-550
Features: +acl +iconv +tui
I was able to reproduce this on neovim (NVIM v0.9.1). Before calling line 488 (view.lua), I just checked if the corresponding index is not out of bounds.
Line 488 :
vim.api.nvim_win_set_cursor(self.parent, { item.start.line + 1, item.start.character })
was changed to :
if vim.api.nvim_buf_line_count(item.bufnr) > item.start.line + 1 then
vim.api.nvim_win_set_cursor(self.parent, { item.start.line + 1, item.start.character })
end
Trouble seems to work fine after the changes and the issue is solved.