Skip to content

Commit

Permalink
feat(copilotchat-nvim): select a picker based on installed one (#1333)
Browse files Browse the repository at this point in the history
* feat: use appropriate picker

* style: format
  • Loading branch information
azdanov authored Jan 25, 2025
1 parent d77305c commit 0e1cf11
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lua/astrocommunity/editing-support/copilotchat-nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ return {
dependencies = {
{ "zbirenbaum/copilot.lua" },
{ "nvim-lua/plenary.nvim" },
{ "nvim-telescope/telescope.nvim" },
{
"AstroNvim/astrocore",
---@param opts AstroCoreOpts
Expand Down Expand Up @@ -71,9 +70,14 @@ return {
-- Helper function to create mappings
local function create_mapping(action_type, selection_type)
return function()
require("CopilotChat.integrations.telescope").pick(require("CopilotChat.actions")[action_type] {
selection = require("CopilotChat.select")[selection_type],
})
local fzf_ok = pcall(require, "fzf-lua")
local snacks_ok = pcall(require, "snacks")

require("CopilotChat.integrations." .. (fzf_ok and "fzflua" or snacks_ok and "snacks" or "telescope")).pick(
require("CopilotChat.actions")[action_type] {
selection = require("CopilotChat.select")[selection_type],
}
)
end
end

Expand Down

0 comments on commit 0e1cf11

Please sign in to comment.