Closed nyngwang closed 1 year ago
I too am seeing the same error, in particular when opening a floating window (whether it is a fuzzy finder, a diagnostic or other types of floating objects); for line 152 I see the stacktrace to be
...ro/.local/share/nvim/lazy/block.nvim/lua/block/block.lua:129: in function 'update'
...ro/.local/share/nvim/lazy/block.nvim/lua/block/block.lua:152: in function 'fn'
vim/_editor.lua:556: in function 'cb'
vim/_editor.lua:324: in function <vim/_editor.lua:323>
(not sure if your PR covers this case too)
@gennaro-tedesco
...ro/.local/share/nvim/lazy/block.nvim/lua/block/block.lua:129: in function 'update'
Yes, exactly this line. This culprit function is called several times in the source I think. (I haven't dived into the source code since it looks a bit complex :P)
(not sure if your PR covers this case too)
I have tested the PR with telescope.nvim, fzf-lua, and NeoZoom.lua(which creates floating windows), so I guess the PR could work. It will still be great if you could try my PR and let me know the result :) Thanks for your report anyway!
It will still be great if you could try my PR and let me know the result :)
I will test it as I finish work (in one hour or so) :)
I tested your PR and all works fine except when using treesitter-objects with the lsp interop preview windows (with that preview window the exception is still generated). I will try to go through the code later with some more time to better understand if there are other conditions that may trigger it.
I too am seeing the same error, in particular when opening a floating window (whether it is a fuzzy finder, a diagnostic or other types of floating objects); for line 152 I see the stacktrace to be
...ro/.local/share/nvim/lazy/block.nvim/lua/block/block.lua:129: in function 'update' ...ro/.local/share/nvim/lazy/block.nvim/lua/block/block.lua:152: in function 'fn' vim/_editor.lua:556: in function 'cb' vim/_editor.lua:324: in function <vim/_editor.lua:323>
(not sure if your PR covers this case too)
Curious...
local success, parser = pcall(ts.get_parser, bufnr)
Should take care of cases where treesitter cant find a parser
@gennaro-tedesco Could you try out https://github.com/HampusHauffman/block.nvim/pull/14
@nyngwang A lot is happening in your PR. Lets see if this fixes the initial issue :)
@HampusHauffman Yes, I forgot to switch to a new branch, lol. Thanks for the redo. Now I just need to create one new PR for #4
@gennaro-tedesco Could you try out #14
All issues seem to be fixed except again for lsp-interop floating window of treesitter-objects 🤔
@gennaro-tedesco Can you post the error message again? I can check this for you. (unfortunately, I don't know about the plugin lsp-interop)
The full error message I get is the following:
Error executing vim.schedule lua callback: ...ro/.local/share/nvim/lazy/block.nvim/lua/block/block.lua:129: attempt to index a nil value
stack traceback:
...ro/.local/share/nvim/lazy/block.nvim/lua/block/block.lua:129: in function 'update'
...ro/.local/share/nvim/lazy/block.nvim/lua/block/block.lua:152: in function 'fn'
vim/_editor.lua:556: in function 'cb'
vim/_editor.lua:324: in function <vim/_editor.lua:323>
In any case the PR #14 seems to be fixing all other scenarios, and treesitter-objects is such a niche use case that I wouldn't lose sleep about it (can be done in a second iteration down the road) :)!
Closing this for now. thank you @gennaro-tedesco and @nyngwang
I have a chance to get the following error after calling
:e
at a buffer with the highlighting of:BlockOn
has been applied.