소스 검색

fix(lualine): set icon color according to the status of treesitter (#2754)

Co-authored-by: emxxjnm <emxxjnm@example>
Myles Mo 2 년 전
부모
커밋
3bc52f9988
1개의 변경된 파일6개의 추가작업 그리고 6개의 파일을 삭제
  1. 6 6
      lua/lvim/core/lualine/components.lua

+ 6 - 6
lua/lvim/core/lualine/components.lua

@@ -70,13 +70,13 @@ return {
   },
   treesitter = {
     function()
-      local b = vim.api.nvim_get_current_buf()
-      if next(vim.treesitter.highlighter.active[b]) then
-        return ""
-      end
-      return ""
+      return ""
+    end,
+    color = function()
+      local buf = vim.api.nvim_get_current_buf()
+      local ts = vim.treesitter.highlighter.active[buf]
+      return { fg = ts and not vim.tbl_isempty(ts) and colors.green or colors.red }
     end,
-    color = { fg = colors.green },
     cond = conditions.hide_in_width,
   },
   lsp = {