mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-22 04:21:08 +00:00
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:
parent
3e8fddcd54
commit
23a1bbdae9
1 changed files with 4 additions and 2 deletions
|
|
@ -1,10 +1,10 @@
|
||||||
local pick = function()
|
local pick = function()
|
||||||
|
local refactoring = require("refactoring")
|
||||||
if LazyVim.pick.picker.name == "telescope" then
|
if LazyVim.pick.picker.name == "telescope" then
|
||||||
return require("telescope").extensions.refactoring.refactors()
|
return require("telescope").extensions.refactoring.refactors()
|
||||||
elseif LazyVim.pick.picker.name == "fzf" then
|
elseif LazyVim.pick.picker.name == "fzf" then
|
||||||
local fzf_lua = require("fzf-lua")
|
local fzf_lua = require("fzf-lua")
|
||||||
local results = require("refactoring").get_refactors()
|
local results = refactoring.get_refactors()
|
||||||
local refactoring = require("refactoring")
|
|
||||||
|
|
||||||
local opts = {
|
local opts = {
|
||||||
fzf_opts = {},
|
fzf_opts = {},
|
||||||
|
|
@ -16,6 +16,8 @@ local pick = function()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
fzf_lua.fzf_exec(results, opts)
|
fzf_lua.fzf_exec(results, opts)
|
||||||
|
else
|
||||||
|
refactoring.select_refactor()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue