From b25ea9c153e76d11579731e1d5529f275a36f91d Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 26 Sep 2025 15:56:03 +0200 Subject: [PATCH] feat(ai.copilot-native): let sidekick.nvim handle some things if available --- .../plugins/extras/ai/copilot-native.lua | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ai/copilot-native.lua b/lua/lazyvim/plugins/extras/ai/copilot-native.lua index 71a6a3ae..310fbd81 100644 --- a/lua/lazyvim/plugins/extras/ai/copilot-native.lua +++ b/lua/lazyvim/plugins/extras/ai/copilot-native.lua @@ -26,17 +26,6 @@ return { opts = { servers = { copilot = { - handlers = { - didChangeStatus = function(err, res, ctx) - if err then - return - end - status[ctx.client_id] = res.kind ~= "Normal" and "error" or res.busy and "pending" or "ok" - if res.status == "Error" then - LazyVim.error("Please use `:LspCopilotSignIn` to sign in to Copilot") - end - end, - }, -- stylua: ignore keys = { { @@ -57,13 +46,25 @@ return { setup = { copilot = function() vim.lsp.inline_completion.enable() - -- Accept inline suggestions or next edits LazyVim.cmp.actions.ai_accept = function() - if vim.lsp.inline_completion.get() then - -- nes_update() -- ensure nes update is triggered after inline completion - return true - end + return vim.lsp.inline_completion.get() + end + + if not LazyVim.has_extra("ai.sidekick") then + vim.lsp.config("copilot", { + handlers = { + didChangeStatus = function(err, res, ctx) + if err then + return + end + status[ctx.client_id] = res.kind ~= "Normal" and "error" or res.busy and "pending" or "ok" + if res.status == "Error" then + LazyVim.error("Please use `:LspCopilotSignIn` to sign in to Copilot") + end + end, + }, + }) end end, }, @@ -76,6 +77,9 @@ return { optional = true, event = "VeryLazy", opts = function(_, opts) + if LazyVim.has_extra("ai.sidekick") then + return + end table.insert( opts.sections.lualine_x, 2,