Add text.reference and text.environment

This commit is contained in:
Stephan Seitz
2021-03-28 21:06:53 +02:00
committed by Stephan Seitz
parent 0556edf5f3
commit 712cc78a1e
6 changed files with 66 additions and 13 deletions

View File

@@ -167,7 +167,10 @@ Mainly for markup languages.
@text.title
@text.literal
@text.uri
@text.math (e.g. for LaTeX math enviroments)
@text.math (e.g. for LaTeX math environments)
@text.environment (e.g. for text environments of markup languages)
@text.environment.name (e.g. for the name/the string indicating the type of text environment)
@text.reference (for footnotes, text references, citations)
@text.note
@text.warning

View File

@@ -85,6 +85,9 @@ hlmap["text.title"] = "TSTitle"
hlmap["text.literal"] = "TSLiteral"
hlmap["text.uri"] = "TSURI"
hlmap["text.math"] = "TSMath"
hlmap["text.reference"] = "TSTextReference"
hlmap["text.environment"] = "TSEnviroment"
hlmap["text.environment.name"] = "TSEnviromentName"
hlmap["text.note"] = "TSNote"
hlmap["text.warning"] = "TSWarning"

View File

@@ -77,6 +77,9 @@ highlight default TSEmphasis term=italic cterm=italic gui=italic
highlight default TSUnderline term=underline cterm=underline gui=underline
highlight default TSStrike term=strikethrough cterm=strikethrough gui=strikethrough
highlight default link TSMath Special
highlight default link TSTextReference Constant
highlight default link TSEnviroment Macro
highlight default link TSEnviromentName Normal
highlight default link TSTitle Title
highlight default link TSLiteral String
highlight default link TSURI Underlined

View File

@@ -1,5 +1,6 @@
[
(chapter)
(part)
(section)
(subsection)
(subsubsection)
@@ -7,4 +8,5 @@
(subparagraph)
(environment)
(displayed_equation)
] @fold

View File

@@ -8,7 +8,7 @@
((environment
(begin
name: (word) @_env)) @text.math
(#match? @_env "^(displaymath|eqn|eqnarray|align)[*]?$"))
(#match? @_env "^(displaymath|equation|multline|eqnarray|align|array|split)[*]?$"))
;; This at the begining of the file would be the alternative to highlight
;; only the interior of the environment
@@ -20,12 +20,29 @@
[
(generic_command_name)
"\\begin"
"\\end"
"\\newcommand"
"\\renewcommand"
"\\DeclareRobustCommand"
"\\DeclareMathOperator"
"\\newglossaryentry"
"\\caption"
"\\cite"
"\\label"
"\\newlabel"
"\\label"
"\\ref"
"\\cref"
"\\eqref"
"\\color"
"\\colorbox"
"\\textcolor"
"\\pagecolor"
"\\definecolor"
"\\definecolorset"
"\\newtheorem"
"\\declaretheorem"
"\\newacronym"
"\\newglossaryentry"
] @function.macro
(comment) @comment
@@ -38,6 +55,7 @@
"\\usepackage"
"\\documentclass"
"\\input"
"\\include"
"\\subfile"
"\\subfileinclude"
"\\subfileinclude"
@@ -51,6 +69,7 @@
] @include
[
"\\part"
"\\chapter"
"\\section"
"\\subsection"
@@ -64,22 +83,34 @@
((word) @punctuation.delimiter
(#eq? @punctuation.delimiter "&"))
[
(label_definition)
(label_reference)
(equation_label_reference)
(label_number)
] @label
["$" "\\[" "\\]" "\\(" "\\)"] @punctuation.delimiter
(label_definition
name: (_) @text.reference)
(label_reference
label: (_) @text.reference)
(equation_label_reference
label: (_) @text.reference)
(label_reference
label: (_) @text.reference)
(label_number
label: (_) @text.reference)
(citation
key: (word) @text.reference)
(key_val_pair
key: (_) @parameter
value: (_))
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
["[" "]" "{" "}"] @punctuation.bracket ;"(" ")" is has no special meaning in LaTeX
(chapter
text: (brace_group) @text.title)
(part
text: (brace_group) @text.title)
(section
text: (brace_group) @text.title)
@@ -128,8 +159,19 @@
((generic_command
name:(generic_command_name) @_name
.
arg: (_) @text.url)
arg: (_) @text.uri)
(#match? @_name "^(\\url|\\href)$"))
(ERROR) @error
[
"\\begin"
"\\end"
] @text.environment
(begin
name: (_) @text.environment.name
(#not-match? @text.environment.name "^(displaymath|equation|multline|eqnarray|align|array|split)[*]?$"))
(end
name: (_) @text.environment.name
(#not-match? @text.environment.name "^(displaymath|equation|multline|eqnarray|align|array|split)[*]?$"))

View File

@@ -127,7 +127,7 @@
(footnote_reference)
(citation_reference)
(reference)
] @constant
] @text.reference
;; Others