فهرست منبع

feat: use icon for copilot in statusline (#3173)

Christian Chiarulli 2 سال پیش
والد
کامیت
dcdfbf1727
1فایلهای تغییر یافته به همراه15 افزوده شده و 2 حذف شده
  1. 15 2
      lua/lvim/core/lualine/components.lua

+ 15 - 2
lua/lvim/core/lualine/components.lua

@@ -16,6 +16,7 @@ local statusline_hl = vim.api.nvim_get_hl_by_name("StatusLine", true)
 local cursorline_hl = vim.api.nvim_get_hl_by_name("CursorLine", true)
 local normal_hl = vim.api.nvim_get_hl_by_name("Normal", true)
 
+vim.api.nvim_set_hl(0, "SLCopilot", { fg = "#6CC644", bg = "NONE" })
 vim.api.nvim_set_hl(0, "SLGitIcon", { fg = "#E8AB53", bg = cursorline_hl.background })
 vim.api.nvim_set_hl(0, "SLBranchName", { fg = normal_hl.foreground, bg = cursorline_hl.background })
 vim.api.nvim_set_hl(0, "SLProgress", { fg = "#ECBE7B", bg = statusline_hl.background })
@@ -122,12 +123,17 @@ return {
       end
       local buf_ft = vim.bo.filetype
       local buf_client_names = {}
+      local copilot_active = false
 
       -- add client
       for _, client in pairs(buf_clients) do
-        if client.name ~= "null-ls" then
+        if client.name ~= "null-ls" and client.name ~= "copilot" then
           table.insert(buf_client_names, client.name)
         end
+
+        if client.name == "copilot" then
+          copilot_active = true
+        end
       end
 
       -- add formatter
@@ -141,7 +147,14 @@ return {
       vim.list_extend(buf_client_names, supported_linters)
 
       local unique_client_names = vim.fn.uniq(buf_client_names)
-      return "[" .. table.concat(unique_client_names, ", ") .. "]"
+
+      local language_servers = "[" .. table.concat(unique_client_names, ", ") .. "]"
+
+      if copilot_active then
+        language_servers = language_servers .. "%#SLCopilot#" .. " " .. lvim.icons.git.Octoface .. "%*"
+      end
+
+      return language_servers
     end,
     separator = separator,
     color = { gui = "bold" },