aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter/highlighter.lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim/treesitter/highlighter.lua')
-rw-r--r--runtime/lua/vim/treesitter/highlighter.lua31
1 files changed, 28 insertions, 3 deletions
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua
index 22b528838c..0ec4ab37ec 100644
--- a/runtime/lua/vim/treesitter/highlighter.lua
+++ b/runtime/lua/vim/treesitter/highlighter.lua
@@ -22,8 +22,25 @@ local _link_default_highlight_once = function(from, to)
return from
end
-TSHighlighter.hl_map = {
+-- If @definition.special does not exist use @definition instead
+local subcapture_fallback = {
+ __index = function(self, capture)
+ local rtn
+ local shortened = capture
+ while not rtn and shortened do
+ shortened = shortened:match('(.*)%.')
+ rtn = shortened and rawget(self, shortened)
+ end
+ rawset(self, capture, rtn or "__notfound")
+ return rtn
+ end
+}
+
+TSHighlighter.hl_map = setmetatable({
["error"] = "Error",
+ ["text.underline"] = "Underlined",
+ ["todo"] = "Todo",
+ ["debug"] = "Debug",
-- Miscs
["comment"] = "Comment",
@@ -35,10 +52,13 @@ TSHighlighter.hl_map = {
["constant"] = "Constant",
["constant.builtin"] = "Special",
["constant.macro"] = "Define",
+ ["define"] = "Define",
+ ["macro"] = "Macro",
["string"] = "String",
["string.regex"] = "String",
["string.escape"] = "SpecialChar",
["character"] = "Character",
+ ["character.special"] = "SpecialChar",
["number"] = "Number",
["boolean"] = "Boolean",
["float"] = "Float",
@@ -64,9 +84,13 @@ TSHighlighter.hl_map = {
["type"] = "Type",
["type.builtin"] = "Type",
+ ["type.qualifier"] = "Type",
+ ["type.definition"] = "Typedef",
+ ["storageclass"] = "StorageClass",
["structure"] = "Structure",
["include"] = "Include",
-}
+ ["preproc"] = "PreProc",
+}, subcapture_fallback)
---@private
local function is_highlight_name(capture_name)
@@ -260,7 +284,8 @@ local function on_line_impl(self, buf, line)
{ end_line = end_row, end_col = end_col,
hl_group = hl,
ephemeral = true,
- priority = tonumber(metadata.priority) or 100 -- Low but leaves room below
+ priority = tonumber(metadata.priority) or 100, -- Low but leaves room below
+ conceal = metadata.conceal,
})
end
if start_row > line then