Skip to content

Commit 11b9eca

Browse files
committed
feat(extensions): migrate treesitter config to an extensions
1 parent f98e951 commit 11b9eca

File tree

6 files changed

+125
-477
lines changed

6 files changed

+125
-477
lines changed

lua/cyberdream/config.lua

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ local M = {}
4545
---@field notify? boolean
4646
---@field rainbow_delimiters? boolean
4747
---@field telescope? boolean
48+
---@field treesitter? boolean
49+
---@field treesittercontext? boolean
4850
---@field trouble? boolean
4951
---@field whichkey? boolean
5052

@@ -92,6 +94,8 @@ local default_options = {
9294
notify = true,
9395
rainbow_delimiters = true,
9496
telescope = true,
97+
treesitter = true,
98+
treesittercontext = true,
9599
trouble = true,
96100
whichkey = true,
97101
},

lua/cyberdream/extensions/base.lua

-25
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ function M.get(opts, t)
124124
LspReferenceRead = { bg = t.bgHighlight },
125125
LspReferenceWrite = { bg = t.bgHighlight },
126126

127-
-- LspDiagnostics
128127
DiagnosticError = { fg = t.red },
129128
DiagnosticWarn = { fg = t.yellow },
130129
DiagnosticInfo = { fg = t.blue },
@@ -144,31 +143,7 @@ function M.get(opts, t)
144143
LspSignatureActiveParameter = { fg = t.orange },
145144
LspCodeLens = { fg = t.grey },
146145
LspInlayHint = { fg = t.grey },
147-
148146
LspInfoBorder = { fg = t.bg },
149-
150-
-- TreeSitter Context
151-
TreeSitterContext = { bg = util.blend(t.bgAlt, t.cyan, 0.9) },
152-
TreeSitterContextLineNumber = { fg = util.blend(t.bgHighlight, t.fg) },
153-
154-
-- TreeSitter Specific
155-
["@variable"] = { fg = t.fg },
156-
["@boolean"] = { link = "Boolean" },
157-
["@number"] = { link = "Number" },
158-
["@keyword"] = { link = "Keyword" },
159-
["@keyword.type"] = { fg = t.orange, italic = true },
160-
["@type.builtin"] = { fg = util.blend(t.purple, t.pink, 0.65) },
161-
162-
-- TreeSitter Markup
163-
["@markup.strong"] = { fg = t.pink, bold = true },
164-
["@markup.italic"] = { fg = t.blue, italic = true },
165-
["@markup.list.unchecked"] = { fg = t.magenta, bold = true },
166-
["@markup.list.checked"] = { fg = t.green, bold = true },
167-
["@markup.link.label"] = { link = "Label" },
168-
["@markup.link.label.markdown_inline"] = { fg = t.cyan },
169-
["@markup.link.markdown_inline"] = { fg = t.blue },
170-
["@markup.link.url"] = { fg = t.blue, underline = true },
171-
["@markup.quote"] = { link = "Comment" },
172147
}
173148

174149
return highlights
+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
local util = require("cyberdream.util")
2+
local M = {}
3+
4+
--- Get extension configuration
5+
--- @param opts Config
6+
--- @param t CyberdreamPalette
7+
function M.get(opts, t)
8+
opts = opts or {}
9+
local highlights = {
10+
["@annotation"] = { link = "PreProc" },
11+
["@attribute"] = { link = "PreProc" },
12+
["@boolean"] = { link = "Boolean" },
13+
["@character"] = { link = "Character" },
14+
["@character.special"] = { link = "SpecialChar" },
15+
["@comment"] = { link = "Comment" },
16+
["@conditional"] = { link = "Conditional" },
17+
["@constant"] = { link = "Constant" },
18+
["@constant.builtin"] = { link = "Special" },
19+
["@constant.macro"] = { link = "Define" },
20+
["@constructor"] = { link = "Special" },
21+
["@debug"] = { link = "Debug" },
22+
["@define"] = { link = "Define" },
23+
["@exception"] = { link = "Exception" },
24+
["@field"] = { link = "Identifier" },
25+
["@float"] = { link = "Float" },
26+
["@function"] = { link = "Function" },
27+
["@function.builtin"] = { link = "Special" },
28+
["@function.call"] = { link = "@function" },
29+
["@function.macro"] = { link = "Macro" },
30+
["@include"] = { link = "Include" },
31+
["@keyword"] = { link = "Keyword" },
32+
["@keyword.coroutine"] = { link = "@keyword" },
33+
["@keyword.function"] = { link = "Keyword" },
34+
["@keyword.operator"] = { link = "@operator" },
35+
["@keyword.return"] = { link = "@keyword" },
36+
["@keyword.type"] = { fg = t.orange, italic = true },
37+
["@label"] = { link = "Label" },
38+
["@markup.heading.1"] = { link = "markdownH1" },
39+
["@markup.heading.2"] = { link = "markdownH2" },
40+
["@markup.heading.3"] = { link = "markdownH3" },
41+
["@markup.heading.4"] = { link = "markdownH4" },
42+
["@markup.heading.5"] = { link = "markdownH5" },
43+
["@markup.heading.6"] = { link = "markdownH6" },
44+
["@markup.italic"] = { fg = t.blue, italic = true },
45+
["@markup.link.label"] = { link = "Label" },
46+
["@markup.link.label.markdown_inline"] = { fg = t.cyan },
47+
["@markup.link.markdown_inline"] = { fg = t.blue },
48+
["@markup.link.url"] = { fg = t.blue, underline = true },
49+
["@markup.list.checked"] = { fg = t.green, bold = true },
50+
["@markup.list.unchecked"] = { fg = t.magenta, bold = true },
51+
["@markup.quote"] = { link = "Comment" },
52+
["@markup.strong"] = { fg = t.pink, bold = true },
53+
["@method"] = { link = "Function" },
54+
["@method.call"] = { link = "@method" },
55+
["@namespace"] = { link = "Include" },
56+
["@none"] = { default = true },
57+
["@number"] = { link = "Number" },
58+
["@operator"] = { link = "Operator" },
59+
["@parameter"] = { link = "Identifier" },
60+
["@preproc"] = { link = "PreProc" },
61+
["@property"] = { link = "Identifier" },
62+
["@punctuation.bracket"] = { link = "Delimiter" },
63+
["@punctuation.delimiter"] = { link = "Delimiter" },
64+
["@punctuation.special"] = { link = "Delimiter" },
65+
["@repeat"] = { link = "Repeat" },
66+
["@storageclass"] = { link = "StorageClass" },
67+
["@string"] = { link = "String" },
68+
["@string.escape"] = { link = "SpecialChar" },
69+
["@string.regex"] = { link = "String" },
70+
["@string.special"] = { link = "SpecialChar" },
71+
["@symbol"] = { link = "Identifier" },
72+
["@tag"] = { link = "Label" },
73+
["@tag.attribute"] = { link = "@property" },
74+
["@tag.delimiter"] = { link = "Delimiter" },
75+
["@text"] = { link = "@none" },
76+
["@text.danger"] = { link = "WarningMsg" },
77+
["@text.emphasis"] = { italic = true },
78+
["@text.environment"] = { link = "Macro" },
79+
["@text.environment.name"] = { link = "Type" },
80+
["@text.literal"] = { link = "String" },
81+
["@text.math"] = { link = "Special" },
82+
["@text.note"] = { link = "SpecialComment" },
83+
["@text.reference"] = { link = "Constant" },
84+
["@text.strike"] = { strikethrough = true },
85+
["@text.strong"] = { bold = true, default = true },
86+
["@text.title"] = { link = "markdownH1" },
87+
["@text.title.2"] = { link = "markdownH2" },
88+
["@text.title.3"] = { link = "markdownH3" },
89+
["@text.title.4"] = { link = "markdownH4" },
90+
["@text.title.5"] = { link = "markdownH5" },
91+
["@text.todo"] = { link = "Todo" },
92+
["@text.underline"] = { underline = true },
93+
["@text.uri"] = { link = "Underlined" },
94+
["@text.warning"] = { link = "Todo" },
95+
["@type"] = { link = "Type" },
96+
["@type.builtin"] = { fg = util.blend(t.purple, t.pink, 0.65) },
97+
["@type.definition"] = { link = "Typedef" },
98+
["@type.qualifier"] = { link = "@keyword" },
99+
["@variable"] = { fg = t.fg },
100+
["@variable.builtin"] = { link = "Special" },
101+
}
102+
103+
return highlights
104+
end
105+
return M
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
local M = {}
2+
local util = require("cyberdream.util")
3+
4+
--- Get extension configuration
5+
--- @param opts Config
6+
--- @param t CyberdreamPalette
7+
function M.get(opts, t)
8+
opts = opts or {}
9+
local highlights = {
10+
TreeSitterContext = { bg = util.blend(t.bgAlt, t.cyan, 0.9) },
11+
TreeSitterContextLineNumber = { fg = util.blend(t.bgHighlight, t.fg) },
12+
}
13+
return highlights
14+
end
15+
return M

0 commit comments

Comments
 (0)