90 lines
2.6 KiB
Lua
90 lines
2.6 KiB
Lua
return {
|
|
|
|
-- copilot
|
|
{
|
|
"zbirenbaum/copilot.lua",
|
|
cmd = "Copilot",
|
|
build = ":Copilot auth",
|
|
opts = {
|
|
suggestion = { enabled = false },
|
|
panel = { enabled = false },
|
|
},
|
|
},
|
|
{
|
|
"nvim-lualine/lualine.nvim",
|
|
event = "VeryLazy",
|
|
opts = function(_, opts)
|
|
local Util = require("lazyvim.util")
|
|
local colors = {
|
|
[""] = Util.fg("Special"),
|
|
["Normal"] = Util.fg("Special"),
|
|
["Warning"] = Util.fg("DiagnosticError"),
|
|
["InProgress"] = Util.fg("DiagnosticWarn"),
|
|
}
|
|
table.insert(opts.sections.lualine_x, 2, {
|
|
function()
|
|
local icon = require("lazyvim.config").icons.kinds.Copilot
|
|
local status = require("copilot.api").status.data
|
|
return icon .. (status.message or "")
|
|
end,
|
|
cond = function()
|
|
local ok, clients = pcall(vim.lsp.get_active_clients, { name = "copilot", bufnr = 0 })
|
|
return ok and #clients > 0
|
|
end,
|
|
color = function()
|
|
local status = require("copilot.api").status.data
|
|
return colors[status.status] or colors[""]
|
|
end,
|
|
})
|
|
end,
|
|
},
|
|
|
|
-- copilot cmp source
|
|
{
|
|
"nvim-cmp",
|
|
dependencies = {
|
|
{
|
|
"zbirenbaum/copilot-cmp",
|
|
dependencies = "copilot.lua",
|
|
opts = {},
|
|
config = function(_, opts)
|
|
local copilot_cmp = require("copilot_cmp")
|
|
copilot_cmp.setup(opts)
|
|
-- attach cmp source whenever copilot attaches
|
|
-- fixes lazy-loading issues with the copilot cmp source
|
|
require("lazyvim.util").on_attach(function(client)
|
|
if client.name == "copilot" then
|
|
copilot_cmp._on_insert_enter({})
|
|
end
|
|
end)
|
|
end,
|
|
},
|
|
},
|
|
---@param opts cmp.ConfigSchema
|
|
opts = function(_, opts)
|
|
local cmp = require("cmp")
|
|
|
|
table.insert(opts.sources, 1, { name = "copilot", group_index = 2 })
|
|
|
|
opts.sorting = {
|
|
priority_weight = 2,
|
|
comparators = {
|
|
require("copilot_cmp.comparators").prioritize,
|
|
|
|
-- Below is the default comparitor list and order for nvim-cmp
|
|
cmp.config.compare.offset,
|
|
-- cmp.config.compare.scopes, --this is commented in nvim-cmp too
|
|
cmp.config.compare.exact,
|
|
cmp.config.compare.score,
|
|
cmp.config.compare.recently_used,
|
|
cmp.config.compare.locality,
|
|
cmp.config.compare.kind,
|
|
cmp.config.compare.sort_text,
|
|
cmp.config.compare.length,
|
|
cmp.config.compare.order,
|
|
},
|
|
}
|
|
end,
|
|
},
|
|
}
|