Skip to content

Commit

Permalink
fix(ui_select): prioritize ui select opts for code actions (#999)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibhagwan committed Jan 13, 2024
1 parent faf850e commit 3d526d2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/fzf-lua/providers/ui_select.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,12 @@ M.ui_select = function(items, ui_opts, on_choice)

-- ui.select is code actions
-- inherit from defaults if not triggered by lsp_code_actions
local opts_merge_strategy = "keep"
if not _OPTS_ONCE and ui_opts.kind == "codeaction" then
_OPTS_ONCE = config.normalize_opts({}, "lsp.code_actions")
-- auto-detected code actions, prioritize the ui_select
-- options over `lsp.code_actions` (#999)
opts_merge_strategy = "force"
end
if _OPTS_ONCE then
-- merge and clear the once opts sent from lsp_code_actions.
Expand All @@ -139,7 +143,7 @@ M.ui_select = function(items, ui_opts, on_choice)
-- multiple keybinds trigger, sending `--expect` to fzf
local previewer = _OPTS_ONCE.previewer
_OPTS_ONCE.previewer = nil -- can't copy the previewer object
opts = vim.tbl_deep_extend("keep", _OPTS_ONCE, opts)
opts = vim.tbl_deep_extend(opts_merge_strategy, _OPTS_ONCE, opts)
opts.actions = { ["default"] = opts.actions["default"] }
opts.previewer = previewer
_OPTS_ONCE = nil
Expand Down

0 comments on commit 3d526d2

Please sign in to comment.