Skip to content

Commit 39d6cc7

Browse files
committed
add treesitter support
1 parent 7b4ed25 commit 39d6cc7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lua/gh-co/syntax.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@ local function setup_highlight_groups()
55
vim.api.nvim_set_hl(0, "CodeownersComment", { link = "Comment" })
66
vim.api.nvim_set_hl(0, "CodeownersPath", { link = "Identifier" })
77
vim.api.nvim_set_hl(0, "CodeownersGlobalPath", { link = "Special" })
8-
vim.api.nvim_set_hl(0, "CodeownersOwner", { link = "String" })
9-
vim.api.nvim_set_hl(0, "CodeownersEmail", { link = "Constant" })
8+
9+
-- Try to use treesitter highlight groups for better theming
10+
local has_treesitter = pcall(require, 'nvim-treesitter')
11+
if has_treesitter and vim.fn.hlexists("@string.special") == 1 then
12+
vim.api.nvim_set_hl(0, "CodeownersOwner", { link = "@string.special" })
13+
else
14+
vim.api.nvim_set_hl(0, "CodeownersOwner", { link = "String" })
15+
end
1016
end
1117

1218
local function highlight_line(bufnr, line_num, line_content)

0 commit comments

Comments
 (0)