From 23a1bbdae90f37aab4a86bfb4c113531a28e7f71 Mon Sep 17 00:00:00 2001 From: RohitB <19793591+rbhanot4739@users.noreply.github.com> Date: Fri, 7 Feb 2025 02:09:37 +0530 Subject: [PATCH] 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) ## Screenshots ## Checklist - [ x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/editor/refactoring.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/editor/refactoring.lua b/lua/lazyvim/plugins/extras/editor/refactoring.lua index 29920347..832940e9 100644 --- a/lua/lazyvim/plugins/extras/editor/refactoring.lua +++ b/lua/lazyvim/plugins/extras/editor/refactoring.lua @@ -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