Skip to content

Commit 884f2ac

Browse files
committed
feat(ui_select): opts.preview_items
1 parent 8634a1c commit 884f2ac

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

lua/fzf-lua/providers/ui_select.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,18 @@ M.ui_select = function(items, ui_opts, on_choice)
174174
-- options over `lsp.code_actions` (#999)
175175
opts_merge_strategy = "force"
176176
end
177-
if _OPTS_ONCE then
177+
178+
if ui_opts.preview_item then
179+
opts.previewer = {
180+
_ctor = function()
181+
local previewer = require("fzf-lua.previewer.builtin").buffer_or_file:extend()
182+
---@diagnostic disable-next-line: unused
183+
function previewer:parse_entry(entry_str, cb) return ui_opts.preview_item(entry_str, cb) end
184+
185+
return previewer
186+
end
187+
}
188+
elseif _OPTS_ONCE then
178189
-- merge and clear the once opts sent from lsp_code_actions.
179190
-- We also override actions to guarantee a single default
180191
-- action, otherwise selected[1] will be empty due to

0 commit comments

Comments
 (0)