fix(finder): handle abort in fzf-lua integration - #2001
Open
aliaksandr-trush wants to merge 1 commit into
Open
Conversation
`Finder:find` documents that `on_select` is invoked with the selected item or `nil` if aborted. Every integration honors this except `fzf_lua`: the `esc`/`ctrl-c`/`ctrl-q` actions only fire when fzf prints one of those keys back, and when the fzf process is instead terminated (window closed, job killed) fzf-lua dispatches no action at all. Through `find_async = a.wrap(Finder.find, 2)`, callers using `open_async` (e.g. `bb` -> `checkout_branch_revision`) `coroutine.yield` waiting for `on_select` to resume them. When `on_select` never runs, the coroutine is suspended forever holding the popup lock (`permits == 0`) and the picker appears dead until Neovim is restarted. Wire fzf-lua's `winopts.on_close` to an abort handler so a picker close still completes the finder via `on_select(nil)`. `on_close` runs before the selected action is dispatched, so it is deferred to the next event loop tick; the `completed` guard (mirroring `mini_pick_choose` and `snacks_confirm`) ensures `on_select` runs exactly once.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Finder:finddocuments thaton_selectis invoked with the selected item ornilif aborted. Every integration honors this exceptfzf_lua: theesc/ctrl-c/ctrl-qactions only fire when fzf prints one of those keys back, and when the fzf process is instead terminated (window closed, job killed) fzf-lua dispatches no action at all.Through
find_async = a.wrap(Finder.find, 2), callers usingopen_async(e.g.bb->checkout_branch_revision)coroutine.yieldwaiting foron_selectto resume them. Whenon_selectnever runs, the coroutine is suspended forever holding the popup lock (permits == 0) and the picker appears dead until Neovim is restarted.Wire fzf-lua's
winopts.on_closeto an abort handler so a picker close still completes the finder viaon_select(nil).on_closeruns before the selected action is dispatched, so it is deferred to the next event loop tick; thecompletedguard (mirroringmini_pick_chooseandsnacks_confirm) ensureson_selectruns exactly once.