Skip to content

Commit c2d9b86

Browse files
committed
fix(win): treesitter race condition (closes #2322)
1 parent c1d33cf commit c2d9b86

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lua/fzf-lua/win.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,8 +948,8 @@ function FzfWin:set_winleave_autocmd()
948948
end
949949

950950
function FzfWin:treesitter_detach(buf)
951-
TSInjector.clear_cache(buf)
952951
TSInjector.deregister()
952+
TSInjector.clear_cache(buf)
953953
end
954954

955955
function FzfWin:treesitter_attach()
@@ -962,6 +962,8 @@ function FzfWin:treesitter_attach()
962962
end
963963
vim.api.nvim_buf_attach(self.fzf_bufnr, false, {
964964
on_lines = function(_, bufnr)
965+
-- Called after `:close` triggers an attach after clear_cache (#2322)
966+
if self.closing then return end
965967
local lines = api.nvim_buf_get_lines(bufnr, 0, -1, false)
966968
local regions = {}
967969
local empty_regions = {}

0 commit comments

Comments
 (0)