mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
Fix lualine issue when copilot is disable
This commit is contained in:
parent
9c1a5620ed
commit
d7d1e30a9e
1 changed files with 7 additions and 2 deletions
|
|
@ -15,6 +15,11 @@ return {
|
|||
optional = true,
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
local ok, copilot_api = pcall(require, "copilot.api")
|
||||
if not ok then
|
||||
return opts
|
||||
end
|
||||
|
||||
local Util = require("lazyvim.util")
|
||||
local colors = {
|
||||
[""] = Util.fg("Special"),
|
||||
|
|
@ -25,7 +30,7 @@ return {
|
|||
table.insert(opts.sections.lualine_x, 2, {
|
||||
function()
|
||||
local icon = require("lazyvim.config").icons.kinds.Copilot
|
||||
local status = require("copilot.api").status.data
|
||||
local status = copilot_api.status.data
|
||||
return icon .. (status.message or "")
|
||||
end,
|
||||
cond = function()
|
||||
|
|
@ -33,7 +38,7 @@ return {
|
|||
return ok and #clients > 0
|
||||
end,
|
||||
color = function()
|
||||
local status = require("copilot.api").status.data
|
||||
local status = copilot_api.status.data
|
||||
return colors[status.status] or colors[""]
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue