Skip to content

Commit 1dcef24

Browse files
andrewbraxtonibhagwan
authored andcommitted
feat(lsp_code_actions): apply based on fzf --select-1
This is an improvement on the default behavior of `--select-1` because it won't flash an fzf window momentarily before applying the code action when there is only one option.
1 parent 63a63d0 commit 1dcef24

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lua/fzf-lua/providers/lsp.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,11 @@ M.code_actions = function(opts)
992992
-- 3rd arg are "once" options to override
993993
-- existing "registered" ui_select options
994994
ui_select.register(opts, true, opts)
995-
vim.lsp.buf.code_action({ context = opts.context, filter = opts.filter })
995+
vim.lsp.buf.code_action({
996+
apply = opts.jump1 or opts.fzf_opts["-1"] or opts.fzf_opts["--select-1"],
997+
context = opts.context,
998+
filter = opts.filter,
999+
})
9961000
-- vim.defer_fn(function()
9971001
-- ui_select.deregister({}, true, true)
9981002
-- end, 100)

0 commit comments

Comments
 (0)