shellRaining / hlchunk.nvim

This is the lua implementation of nvim-hlchunk, you can use this neovim plugin to highlight your indent line and the current chunk (context) your cursor stayed
MIT License
472 stars 29 forks source link

Error when deleting or renaming files #116

Closed sho-87 closed 1 month ago

sho-87 commented 1 month ago

When I use neo-tree (popup) to rename files or to delete them, especially if they are already open in a window, I will get a hlchunk error that looks like:

   Error  4:09:39 PM msg_show.lua_error Error executing vim.schedule lua callback: ...data/lazy/hlchunk.nvim/lua/hlchunk/utils/chunkHelper.lua:22: Invalid buffer id: 132
stack traceback:
    [C]: in function '__index'
    ...data/lazy/hlchunk.nvim/lua/hlchunk/utils/chunkHelper.lua:22: in function 'has_treesitter'
    ...data/lazy/hlchunk.nvim/lua/hlchunk/utils/chunkHelper.lua:62: in function 'get_chunk_range'
    ...m-data/lazy/hlchunk.nvim/lua/hlchunk/mods/chunk/init.lua:178: in function 'fn'
    .../nvim-data/lazy/hlchunk.nvim/lua/hlchunk/utils/timer.lua:64: in function 'fn'
    .../nvim-data/lazy/hlchunk.nvim/lua/hlchunk/utils/timer.lua:16: in function <.../nvim-data/lazy/hlchunk.nvim/lua/hlchunk/utils/timer.lua:15>
   Error  4:09:39 PM msg_show.lua_error Error executing vim.schedule lua callback: ...data/lazy/hlchunk.nvim/lua/hlchunk/utils/chunkHelper.lua:22: Invalid buffer id: 132
stack traceback:
    [C]: in function '__index'
    ...data/lazy/hlchunk.nvim/lua/hlchunk/utils/chunkHelper.lua:22: in function 'has_treesitter'
    ...data/lazy/hlchunk.nvim/lua/hlchunk/utils/chunkHelper.lua:62: in function 'get_chunk_range'
    ...m-data/lazy/hlchunk.nvim/lua/hlchunk/mods/chunk/init.lua:178: in function 'fn'
    .../nvim-data/lazy/hlchunk.nvim/lua/hlchunk/utils/timer.lua:64: in function 'fn'
    .../nvim-data/lazy/hlchunk.nvim/lua/hlchunk/utils/timer.lua:16: in function <.../nvim-data/lazy/hlchunk.nvim/lua/hlchunk/utils/timer.lua:15>
shellRaining commented 1 month ago

Kapture 2024-06-16 at 23 34 27

can't reproduce, can you provide more infomation?

sho-87 commented 1 month ago

hmm this is quite hard to reproduce as it feels quite random. the next time I experience it, what information should I grab that might be useful in diagnosing the problem?

shellRaining commented 1 month ago

add a buf id check before render, now this would not happened (maybe...)