mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-22 04:21:08 +00:00
feat(ai.copilot-native): let sidekick.nvim handle some things if available
This commit is contained in:
parent
e9bc6074d1
commit
b25ea9c153
1 changed files with 20 additions and 16 deletions
|
|
@ -26,17 +26,6 @@ return {
|
||||||
opts = {
|
opts = {
|
||||||
servers = {
|
servers = {
|
||||||
copilot = {
|
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
|
-- stylua: ignore
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
|
|
@ -57,13 +46,25 @@ return {
|
||||||
setup = {
|
setup = {
|
||||||
copilot = function()
|
copilot = function()
|
||||||
vim.lsp.inline_completion.enable()
|
vim.lsp.inline_completion.enable()
|
||||||
|
|
||||||
-- Accept inline suggestions or next edits
|
-- Accept inline suggestions or next edits
|
||||||
LazyVim.cmp.actions.ai_accept = function()
|
LazyVim.cmp.actions.ai_accept = function()
|
||||||
if vim.lsp.inline_completion.get() then
|
return vim.lsp.inline_completion.get()
|
||||||
-- nes_update() -- ensure nes update is triggered after inline completion
|
|
||||||
return true
|
|
||||||
end
|
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
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
@ -76,6 +77,9 @@ return {
|
||||||
optional = true,
|
optional = true,
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
|
if LazyVim.has_extra("ai.sidekick") then
|
||||||
|
return
|
||||||
|
end
|
||||||
table.insert(
|
table.insert(
|
||||||
opts.sections.lualine_x,
|
opts.sections.lualine_x,
|
||||||
2,
|
2,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue