From c4a16b83b3f99c1f8c7481835b44c59213bfdc66 Mon Sep 17 00:00:00 2001 From: Oliver Marriott Date: Wed, 9 Nov 2022 22:18:13 +1100 Subject: [PATCH] Tweak sym calls and add some documentation --- lua/lush_theme/lush_template.lua | 106 +++++++++++++++++-------------- 1 file changed, 59 insertions(+), 47 deletions(-) diff --git a/lua/lush_theme/lush_template.lua b/lua/lush_theme/lush_template.lua index dc168ce..c7ab225 100644 --- a/lua/lush_theme/lush_template.lua +++ b/lua/lush_theme/lush_template.lua @@ -208,54 +208,66 @@ local theme = lush(function(injected_functions) -- Tree-Sitter syntax groups. -- - -- See :h treesitter-highlight-groups, some groups may not be listed, submit a PR fix to lush-template! - -- the sym function below is from: https://github.com/rktjmp/lush.nvim/issues/109 + -- See :h treesitter-highlight-groups, some groups may not be listed, + -- submit a PR fix to lush-template! + -- + -- Tree-Sitter groups are defined with an "@" symbol, which must be + -- specially handled to be valid lua code, we do this via the special + -- sym function. The following are all valid ways to call the sym function, + -- for more details see https://www.lua.org/pil/5.html + -- + -- sym("@text.literal") + -- sym('@text.literal') + -- sym"@text.literal" + -- sym'@text.literal' + -- + -- For more information see https://github.com/rktjmp/lush.nvim/issues/109 - -- sym('@text.literal')({}), -- Comment - -- sym('@text.reference')({}), -- Identifier - -- sym('@text.title')({}), -- Title - -- sym('@text.uri')({}), -- Underlined - -- sym('@text.underline')({}), -- Underlined - -- sym('@text.todo')({}), -- Todo - -- sym('@comment')({}), -- Comment - -- sym('@punctuation')({}), -- Delimiter - -- sym('@constant')({}), -- Constant - -- sym('@constant.builtin')({}), -- Special - -- sym('@constant.macro')({}), -- Define - -- sym('@define')({}), -- Define - -- sym('@macro')({}), -- Macro - -- sym('@string')({}), -- String - -- sym('@string.escape')({}), -- SpecialChar - -- sym('@string.special')({}), -- SpecialChar - -- sym('@character')({}), -- Character - -- sym('@character.special')({}), -- SpecialChar - -- sym('@number')({}), -- Number - -- sym('@boolean')({}), -- Boolean - -- sym('@float')({}), -- Float - -- sym('@function')({}), -- Function - -- sym('@function.builtin')({}), -- Special - -- sym('@function.macro')({}), -- Macro - -- sym('@parameter')({}), -- Identifier - -- sym('@method')({}), -- Function - -- sym('@field')({}), -- Identifier - -- sym('@property')({}), -- Identifier - -- sym('@constructor')({}), -- Special - -- sym('@conditional')({}), -- Conditional - -- sym('@repeat')({}), -- Repeat - -- sym('@label')({}), -- Label - -- sym('@operator')({}), -- Operator - -- sym('@keyword')({}), -- Keyword - -- sym('@exception')({}), -- Exception - -- sym('@variable')({}), -- Identifier - -- sym('@type')({}), -- Type - -- sym('@type.definition')({}), -- Typedef - -- sym('@storageclass')({}), -- StorageClass - -- sym('@structure')({}), -- Structure - -- sym('@namespace')({}), -- Identifier - -- sym('@include')({}), -- Include - -- sym('@preproc')({}), -- PreProc - -- sym('@debug')({}), -- Debug - -- sym('@tag')({}), -- Tag + -- sym"@text.literal" { }, -- Comment + -- sym"@text.reference" { }, -- Identifier + -- sym"@text.title" { }, -- Title + -- sym"@text.uri" { }, -- Underlined + -- sym"@text.underline" { }, -- Underlined + -- sym"@text.todo" { }, -- Todo + -- sym"@comment" { }, -- Comment + -- sym"@punctuation" { }, -- Delimiter + -- sym"@constant" { }, -- Constant + -- sym"@constant.builtin" { }, -- Special + -- sym"@constant.macro" { }, -- Define + -- sym"@define" { }, -- Define + -- sym"@macro" { }, -- Macro + -- sym"@string" { }, -- String + -- sym"@string.escape" { }, -- SpecialChar + -- sym"@string.special" { }, -- SpecialChar + -- sym"@character" { }, -- Character + -- sym"@character.special" { }, -- SpecialChar + -- sym"@number" { }, -- Number + -- sym"@boolean" { }, -- Boolean + -- sym"@float" { }, -- Float + -- sym"@function" { }, -- Function + -- sym"@function.builtin" { }, -- Special + -- sym"@function.macro" { }, -- Macro + -- sym"@parameter" { }, -- Identifier + -- sym"@method" { }, -- Function + -- sym"@field" { }, -- Identifier + -- sym"@property" { }, -- Identifier + -- sym"@constructor" { }, -- Special + -- sym"@conditional" { }, -- Conditional + -- sym"@repeat" { }, -- Repeat + -- sym"@label" { }, -- Label + -- sym"@operator" { }, -- Operator + -- sym"@keyword" { }, -- Keyword + -- sym"@exception" { }, -- Exception + -- sym"@variable" { }, -- Identifier + -- sym"@type" { }, -- Type + -- sym"@type.definition" { }, -- Typedef + -- sym"@storageclass" { }, -- StorageClass + -- sym"@structure" { }, -- Structure + -- sym"@namespace" { }, -- Identifier + -- sym"@include" { }, -- Include + -- sym"@preproc" { }, -- PreProc + -- sym"@debug" { }, -- Debug + -- sym"@tag" { }, -- Tag } end)