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,
|
optional = true,
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
|
local ok, copilot_api = pcall(require, "copilot.api")
|
||||||
|
if not ok then
|
||||||
|
return opts
|
||||||
|
end
|
||||||
|
|
||||||
local Util = require("lazyvim.util")
|
local Util = require("lazyvim.util")
|
||||||
local colors = {
|
local colors = {
|
||||||
[""] = Util.fg("Special"),
|
[""] = Util.fg("Special"),
|
||||||
|
|
@ -25,7 +30,7 @@ return {
|
||||||
table.insert(opts.sections.lualine_x, 2, {
|
table.insert(opts.sections.lualine_x, 2, {
|
||||||
function()
|
function()
|
||||||
local icon = require("lazyvim.config").icons.kinds.Copilot
|
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 "")
|
return icon .. (status.message or "")
|
||||||
end,
|
end,
|
||||||
cond = function()
|
cond = function()
|
||||||
|
|
@ -33,7 +38,7 @@ return {
|
||||||
return ok and #clients > 0
|
return ok and #clients > 0
|
||||||
end,
|
end,
|
||||||
color = function()
|
color = function()
|
||||||
local status = require("copilot.api").status.data
|
local status = copilot_api.status.data
|
||||||
return colors[status.status] or colors[""]
|
return colors[status.status] or colors[""]
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue