From 7b804bfc67812eb899a0ab151e699df63abc7047 Mon Sep 17 00:00:00 2001 From: GitMurf <64155612+GitMurf@users.noreply.github.com> Date: Thu, 30 May 2024 11:26:17 -0700 Subject: [PATCH] fix(cmp): unlist copilot-chat buffer after cmp item acceptance - nvim-cmp always sets buf to listed anytime you accept a cmp item --- lua/CopilotChat/integrations/cmp.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/CopilotChat/integrations/cmp.lua b/lua/CopilotChat/integrations/cmp.lua index 5008395d..feb9eaaf 100644 --- a/lua/CopilotChat/integrations/cmp.lua +++ b/lua/CopilotChat/integrations/cmp.lua @@ -30,6 +30,13 @@ function Source:complete(params, callback) callback({ items = items }) end +---@param completion_item lsp.CompletionItem +---@param callback fun(completion_item: lsp.CompletionItem|nil) +function Source:execute(completion_item, callback) + callback(completion_item) + vim.api.nvim_set_option_value('buflisted', false, { buf = 0 }) +end + local M = {} --- Setup the nvim-cmp source for copilot-chat window