feat(refactoring): fallback to using vim ui select for refactoring.nvim (#5540)

## Description

Fallback to using `require("refactoring").select_refactor()` if neither
of `telescope` or `fzf-lua` is installed. Since `select_refactor()` uses
`vim.ui.select` internally, it can use `snacks.picker` if it is enabled.
## Related Issue(s)

<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->

## Screenshots

<!-- Add screenshots of the changes if applicable. -->

## Checklist

- [ x] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.
This commit is contained in:
RohitB 2025-02-07 02:09:37 +05:30 committed by GitHub
parent 3e8fddcd54
commit 23a1bbdae9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,10 +1,10 @@
local pick = function()
local refactoring = require("refactoring")
if LazyVim.pick.picker.name == "telescope" then
return require("telescope").extensions.refactoring.refactors()
elseif LazyVim.pick.picker.name == "fzf" then
local fzf_lua = require("fzf-lua")
local results = require("refactoring").get_refactors()
local refactoring = require("refactoring")
local results = refactoring.get_refactors()
local opts = {
fzf_opts = {},
@ -16,6 +16,8 @@ local pick = function()
},
}
fzf_lua.fzf_exec(results, opts)
else
refactoring.select_refactor()
end
end