Skip to content

Commit 9fa87ea

Browse files
phanenibhagwan
authored andcommitted
fix(ui_select): pending deregister when vim.ui.select is not called in codeactions
1 parent ce40b36 commit 9fa87ea

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

lua/fzf-lua/providers/ui_select.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,16 @@ M.ui_select = function(items, ui_opts, on_choice)
156156
-- ui.select is code actions
157157
-- inherit from defaults if not triggered by lsp_code_actions
158158
local opts_merge_strategy = "keep"
159+
160+
-- fix error when vim.lsp.buf.code_action() called but didn't triggers vim.ui.select
161+
-- _OPTS_ONCE also means pending deregister
162+
-- since we only use it to custom codeaction preview now
163+
if _OPTS_ONCE and ui_opts.kind ~= "codeaction" then
164+
M.deregister({}, true, true)
165+
_OPTS_ONCE = nil
166+
return vim.ui.select(items, ui_opts, on_choice)
167+
end
168+
159169
if not _OPTS_ONCE and ui_opts.kind == "codeaction" then
160170
---@type fzf-lua.config.LspCodeActions
161171
_OPTS_ONCE = config.normalize_opts({}, "lsp.code_actions")

0 commit comments

Comments
 (0)