Skip to content

Commit 0e1cf11

Browse files
authored
feat(copilotchat-nvim): select a picker based on installed one (#1333)
* feat: use appropriate picker * style: format
1 parent d77305c commit 0e1cf11

File tree

1 file changed

+8
-4
lines changed
  • lua/astrocommunity/editing-support/copilotchat-nvim

1 file changed

+8
-4
lines changed

lua/astrocommunity/editing-support/copilotchat-nvim/init.lua

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ return {
2525
dependencies = {
2626
{ "zbirenbaum/copilot.lua" },
2727
{ "nvim-lua/plenary.nvim" },
28-
{ "nvim-telescope/telescope.nvim" },
2928
{
3029
"AstroNvim/astrocore",
3130
---@param opts AstroCoreOpts
@@ -71,9 +70,14 @@ return {
7170
-- Helper function to create mappings
7271
local function create_mapping(action_type, selection_type)
7372
return function()
74-
require("CopilotChat.integrations.telescope").pick(require("CopilotChat.actions")[action_type] {
75-
selection = require("CopilotChat.select")[selection_type],
76-
})
73+
local fzf_ok = pcall(require, "fzf-lua")
74+
local snacks_ok = pcall(require, "snacks")
75+
76+
require("CopilotChat.integrations." .. (fzf_ok and "fzflua" or snacks_ok and "snacks" or "telescope")).pick(
77+
require("CopilotChat.actions")[action_type] {
78+
selection = require("CopilotChat.select")[selection_type],
79+
}
80+
)
7781
end
7882
end
7983

0 commit comments

Comments
 (0)