Closed tummetott closed 6 months ago
This is now fixed in Trouble v3. Thank you for reporting!
Awesome, took you 11 minutes, you're a machine 😄
I thought it's an edgy error, thanks for fixing
i get a very similar error nowadays, using the following versions
E5108: Error executing lua: ....local/share/nvim/lazy/trouble.nvim/lua/trouble/view.lua:392: Invalid window id: 1009
stack traceback:
[C]: in function 'get_cursor'
....local/share/nvim/lazy/trouble.nvim/lua/trouble/view.lua:392: in function 'get_line'
....local/share/nvim/lazy/trouble.nvim/lua/trouble/view.lua:406: in function 'next_item'
....local/share/nvim/lazy/trouble.nvim/lua/trouble/init.lua:267: in function 'next'
/home/amtoine/.config/nvim/lua/custom/lsp.lua:109: in function </home/amtoine/.config/nvim/lua/custom/lsp.lua:109>
i'm trying to use Trouble functions to jump around in the list of diagnostics
local nmap = function(keys, func, desc, bufnr)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { buffer = bufnr, silent = true, noremap = true, desc = desc })
end
-- ...
local trouble = require("trouble")
-- ...
local jump = function(fn)
return function() fn({skip_groups = true, jump = true}) end
end
nmap("<leader>ltj", jump(trouble.next), "Jump to next item")
nmap("<leader>ltk", jump(trouble.previous), "Jump to previous item")
nmap("<leader>ltg", jump(trouble.first), "Jump to first item")
nmap("<leader>ltG", jump(trouble.last), "Jump to last item")
-- ...
Note
- before opening the Trouble window for the first time, the 4 bindings above don't do anything.
- after the first time the Trouble window has been opened there are two cases
- if the Trouble window is CLOSED: then the error appears
- if the Trouble window is OPENED: the 4 bindings work as expected
Did you check docs and existing issues?
Neovim version (nvim -v)
NVIM v0.9.5 Build type: Release LuaJIT 2.1.1703358377
Operating system/version
MacOs 14.2.1
Describe the bug
I get a
invalid window id
error:Steps To Reproduce
nvim -u repro.lua
:Trouble quickfix
Open a emtpy trouble window. it can also be diagnostics or whatever, it does not matter:lua require('edgy').close()
Close the Edgy Window:Trouble quickfix
Open trouble againBTW: the same error occurs in several scenarios, this is just one reproduction
Expected Behavior
No Error
Repro