Skip to content

Commit bda69f0

Browse files
authored
feat(treesitter): add more hl groups and reformat to mirror docs (#26)
1 parent 38179a8 commit bda69f0

File tree

1 file changed

+81
-68
lines changed

1 file changed

+81
-68
lines changed

lua/astrotheme/groups/plugins/nvim-treesitter.lua

Lines changed: 81 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -3,75 +3,120 @@ local function callback()
33

44
-- misc
55
["@comment"] = { link = "Comment" },
6-
["@define"] = { link = "Define" },
6+
["@comment.documentation"] = { link = "@comment" },
77
["@error"] = { link = "Error" },
8-
["@operator"] = { link = "Operator" },
8+
["@none"] = { link = "@Comment" },
99
["@preproc"] = { link = "PreProc" },
10+
["@define"] = { link = "Define" },
11+
["@operator"] = { link = "Operator" },
1012

11-
-- data types
12-
["@boolean"] = { link = "Boolean" },
13-
["@number"] = { link = "Number" },
14-
["@float"] = { link = "Float" },
13+
-- punctuation
14+
["@punctuation.bracket"] = { fg = C.text },
15+
["@punctuation.delimiter"] = { fg = C.text },
16+
["@punctuation.special"] = { link = "Special" },
17+
18+
-- literals
1519
["@string"] = { link = "String" },
1620
["@string.escape"] = { fg = C.red },
1721
["@string.regex"] = { link = "String" },
1822
["@string.special"] = { link = "String" },
23+
1924
["@character"] = { link = "Character" },
2025
["@character.special"] = { link = "SpecialChar" },
2126

22-
["@annotation"] = { fg = C.yellow },
23-
["@attribute"] = { fg = C.red },
27+
["@boolean"] = { link = "Boolean" },
28+
["@number"] = { link = "Number" },
29+
["@float"] = { link = "Float" },
2430

2531
-- function
26-
["@constructor"] = { fg = C.yellow },
2732
["@function"] = { link = "Function" },
2833
["@function.builtin"] = { fg = C.cyan },
2934
["@function.call"] = { link = "@function" },
3035
["@function.macro"] = { fg = C.yellow },
36+
3137
["@method"] = { fg = C.cyan },
3238
["@method.call"] = { link = "@method" },
3339

34-
-- identifiers
35-
["@constant"] = { link = "Constant" },
36-
["@constant.builtin"] = { fg = C.orange },
37-
["@constant.macro"] = { fg = C.red },
38-
39-
["@namespace"] = { link = "Keyword" },
40-
["@symbol"] = { link = "Special" },
41-
42-
["@variable"] = { link = "Identifier" },
43-
["@variable.builtin"] = { fg = C.red },
44-
45-
["@property"] = { link = "@variable.builtin" },
40+
["@constructor"] = { fg = C.yellow },
41+
["@parameter"] = { fg = C.orange },
4642

4743
-- keyword
48-
["@conditional"] = { link = "Conditional" },
49-
["@exception"] = { link = "Exception" },
50-
["@include"] = { link = "Include" },
51-
5244
["@keyword"] = { link = "Keyword" },
53-
["@keyword.export"] = { link = "Keyword" },
45+
["@keyword.corotine"] = { link = "Keyword" },
5446
["@keyword.function"] = { link = "Keyword" },
5547
["@keyword.operator"] = { link = "Keyword" },
5648
["@keyword.return"] = { link = "Keyword" },
49+
["@keyword.export"] = { link = "Keyword" },
5750

58-
["@label"] = { link = "Label" },
59-
["@parameter"] = { fg = C.orange },
60-
["@parameter.reference"] = { fg = C.cyan },
51+
["@conditional"] = { link = "Conditional" },
52+
["@conditional.ternary"] = { link = "@conditional" },
6153

6254
["@repeat"] = { link = "Repeat" },
55+
["@debug"] = { link = "Debug" },
56+
["@label"] = { link = "Label" },
57+
["@include"] = { link = "Include" },
58+
["@exception"] = { link = "Exception" },
6359

64-
-- punctuation
65-
["@punctuation.bracket"] = { fg = C.text },
66-
["@punctuation.delimiter"] = { fg = C.text },
67-
["@punctuation.special"] = { fg = C.text },
60+
-- types
61+
["@type"] = { link = "Type" },
62+
["@type.builtin"] = { link = "@type" },
63+
["@type.definition"] = { link = "@type" },
64+
["@type.qualifier"] = { link = "@type" },
65+
66+
["@storageclass"] = { link = "StorageClass" },
67+
["@attribute"] = { fg = C.yellow },
68+
["@field"] = { link = "@variable.builtin" },
69+
["@property"] = { link = "@variable.builtin" },
70+
71+
-- identifiers
72+
["@variable"] = { link = "Identifier" },
73+
["@variable.builtin"] = { fg = C.red },
74+
75+
["@constant"] = { link = "Constant" },
76+
["@constant.builtin"] = { link = "@constant" },
77+
["@constant.macro"] = { link = "@constant" },
78+
79+
["@namespace"] = { link = "Keyword" },
80+
["@symbol"] = { link = "Special" },
81+
82+
-- text
83+
["@text"] = { fg = C.text },
84+
["@text.strong"] = { fg = C.blue, bold = true },
85+
["@text.emphasis"] = { fg = C.purple, italic = true },
86+
["@text.underline"] = { link = "Underline" },
87+
["@text.strike"] = { fg = C.green, strikethrough = true },
88+
["@text.title"] = { fg = C.text, bold = true },
89+
["@text.literal"] = { fg = C.text },
90+
["@text.quote"] = { fg = C.text, italic = true },
91+
["@text.uri"] = { fg = C.green, italic = true, underline = true },
92+
["@text.math"] = { fg = C.blue },
93+
["@text.environment"] = { fg = C.orange },
94+
["@text.environment.name"] = { fg = C.blue },
95+
["@text.reference"] = { fg = C.yellow, bold = true },
96+
97+
["@text.todo"] = { fg = C.base, bg = C.yellow },
98+
["@text.note"] = { fg = C.base, bg = C.blue },
99+
["@text.todo.note"] = { link = "@text.note" },
100+
["@text.warning"] = { fg = C.base, bg = C.yellow },
101+
["@text.todo.warning"] = { link = "@text.warning" },
102+
["@text.danger"] = { fg = C.base, bg = C.red },
103+
["@text.todo.danger"] = { link = "@text.danger" },
104+
["@text.unchecked"] = { fg = C.overlay1 },
105+
["@text.todo.unchecked"] = { link = "@text.unchecked" },
106+
["@text.checked"] = { fg = C.green },
107+
["@text.todo.checked"] = { link = "@text.checked" },
108+
109+
["@text.diff.add"] = { link = "DiffAdded" },
110+
["@text.diff.delete"] = { link = "DiffDelete" },
68111

69112
-- tag
70113
["@tag"] = { fg = C.red },
71114
["@tag.attribute"] = { fg = C.cyan },
72115
["@tag.delimiter"] = { fg = C.text },
73116

74117
-- semantic tokens
118+
-- NOTE: these can not be found in the documentation are are specific
119+
["@annotation"] = { fg = C.yellow },
75120
["@class"] = { fg = C.blue },
76121
["@decorator"] = { fg = C.orange },
77122
["@enum"] = { fg = C.cyan },
@@ -83,39 +128,6 @@ local function callback()
83128
["@struct"] = { fg = C.blue },
84129
["@typeParameter"] = { fg = C.yellow },
85130

86-
-- text
87-
["@text"] = { fg = C.text },
88-
["@text.emphasis"] = { fg = C.purple, italic = true },
89-
["@text.environment"] = { fg = C.orange },
90-
["@text.environment.name"] = { fg = C.blue },
91-
["@text.literal"] = { fg = C.text },
92-
["@text.math"] = { fg = C.blue },
93-
["@text.reference"] = { fg = C.yellow, bold = true },
94-
["@text.strong"] = { fg = C.blue, bold = true },
95-
["@text.strike"] = { fg = C.green, strikethrough = true },
96-
["@text.title"] = { fg = C.text, bold = true },
97-
["@text.underline"] = { link = "Underline" },
98-
["@text.uri"] = { fg = C.green, italic = true, underline = true },
99-
100-
["@text.todo"] = { fg = C.base, bg = C.yellow },
101-
["@text.todo.checked"] = { fg = C.green },
102-
["@text.todo.danger"] = { fg = C.base, bg = C.red },
103-
["@text.todo.note"] = { fg = C.base, bg = C.blue },
104-
["@text.todo.unchecked"] = { fg = C.overlay1 },
105-
["@text.todo.warning"] = { fg = C.base, bg = C.yellow },
106-
107-
["@text.diff.add"] = { link = "DiffAdded" },
108-
["@text.diff.delete"] = { link = "DiffDelete" },
109-
110-
-- type
111-
["@field"] = { fg = C.red },
112-
["@storageclass"] = { link = "StorageClass" },
113-
114-
["@type"] = { link = "Type" },
115-
["@type.builtin"] = { link = "@type" },
116-
["@type.definition"] = { link = "@type" },
117-
["@type.qualifier"] = { link = "@type" },
118-
119131
-----------------------
120132
-- Language Specific --
121133
-----------------------
@@ -162,7 +174,7 @@ local function callback()
162174
["@type.rust"] = { fg = C.yellow },
163175

164176
-- toml
165-
["@property.toml"] = { fg = C.blue },
177+
["@property.toml"] = { fg = C.red },
166178

167179
-- typescript
168180
["@type.qualifier.typescript"] = { link = "Keyword" },
@@ -172,8 +184,9 @@ local function callback()
172184
["@tag.attribute.tsx"] = { fg = C.purple, italic = true },
173185

174186
-- yaml
175-
["@field.yaml"] = { fg = C.blue },
187+
["@field.yaml"] = { fg = C.red },
176188
}
189+
-- https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md
177190
end
178191

179192
return callback

0 commit comments

Comments
 (0)