You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
helix-plus/runtime/queries/latex/highlights.scm

236 lines
5.4 KiB
Scheme

;; General syntax
(ERROR) @error
4 years ago
(command_name) @function
(caption
command: _ @function)
4 years ago
(key_value_pair
key: (_) @variable.parameter
value: (_))
4 years ago
[
(comment)
(line_comment)
(block_comment)
(comment_environment)
] @comment
4 years ago
[
(brack_group)
(brack_group_argc)
] @variable.parameter
4 years ago
[(operator) "="] @operator
4 years ago
"\\item" @punctuation.special
4 years ago
((word) @punctuation.delimiter
(#eq? @punctuation.delimiter "&"))
4 years ago
["[" "]" "{" "}"] @punctuation.bracket ; "(" ")" has no syntactical meaning in LaTeX
4 years ago
;; General environments
(begin
command: _ @function.builtin
name: (curly_group_text (text) @function.macro))
4 years ago
(end
command: _ @function.builtin
name: (curly_group_text (text) @function.macro))
;; Definitions and references
(new_command_definition
command: _ @function.macro
declaration: (curly_group_command_name (_) @function))
(old_command_definition
command: _ @function.macro
declaration: (_) @function)
(let_command_definition
command: _ @function.macro
declaration: (_) @function)
(environment_definition
command: _ @function.macro
name: (curly_group_text (_) @constant))
(theorem_definition
command: _ @function.macro
name: (curly_group_text (_) @constant))
(paired_delimiter_definition
command: _ @function.macro
declaration: (curly_group_command_name (_) @function))
4 years ago
(label_definition
command: _ @function.macro
name: (curly_group_text (_) @label))
(label_reference_range
command: _ @function.macro
from: (curly_group_text (_) @label)
to: (curly_group_text (_) @label))
(label_reference
command: _ @function.macro
names: (curly_group_text_list (_) @label))
(label_number
command: _ @function.macro
name: (curly_group_text (_) @label)
number: (_) @markup.link.label)
4 years ago
(citation
command: _ @function.macro
keys: (curly_group_text_list) @string)
(glossary_entry_definition
command: _ @function.macro
name: (curly_group_text (_) @string))
(glossary_entry_reference
command: _ @function.macro
name: (curly_group_text (_) @string))
(acronym_definition
command: _ @function.macro
name: (curly_group_text (_) @string))
(acronym_reference
command: _ @function.macro
name: (curly_group_text (_) @string))
(color_definition
command: _ @function.macro
name: (curly_group_text (_) @string))
(color_reference
command: _ @function.macro
name: (curly_group_text (_) @string))
4 years ago
;; Math
4 years ago
(displayed_equation) @markup.raw.block
(inline_formula) @markup.raw.inline
4 years ago
(math_environment
(begin
command: _ @function.builtin
name: (curly_group_text (text) @markup.raw)))
4 years ago
(math_environment
(text) @markup.raw)
4 years ago
(math_environment
(end
command: _ @function.builtin
name: (curly_group_text (text) @markup.raw)))
4 years ago
;; Sectioning
(title_declaration
command: _ @namespace
options: (brack_group (_) @markup.heading)?
text: (curly_group (_) @markup.heading))
4 years ago
(author_declaration
command: _ @namespace
authors: (curly_group_author_list
((author)+ @markup.heading)))
4 years ago
(chapter
command: _ @namespace
toc: (brack_group (_) @markup.heading)?
text: (curly_group (_) @markup.heading))
4 years ago
(part
command: _ @namespace
toc: (brack_group (_) @markup.heading)?
text: (curly_group (_) @markup.heading))
4 years ago
(section
command: _ @namespace
toc: (brack_group (_) @markup.heading)?
text: (curly_group (_) @markup.heading))
4 years ago
(subsection
command: _ @namespace
toc: (brack_group (_) @markup.heading)?
text: (curly_group (_) @markup.heading))
4 years ago
(subsubsection
command: _ @namespace
toc: (brack_group (_) @markup.heading)?
text: (curly_group (_) @markup.heading))
4 years ago
(paragraph
command: _ @namespace
toc: (brack_group (_) @markup.heading)?
text: (curly_group (_) @markup.heading))
4 years ago
(subparagraph
command: _ @namespace
toc: (brack_group (_) @markup.heading)?
text: (curly_group (_) @markup.heading))
4 years ago
;; Beamer frames
(generic_environment
4 years ago
(begin
name: (curly_group_text
(text) @markup.heading)
(#any-of? @markup.heading "frame"))
.
(curly_group (_) @markup.heading))
4 years ago
((generic_command
command: (command_name) @_name
arg: (curly_group
(text) @markup.heading))
(#eq? @_name "\\frametitle"))
4 years ago
;; Formatting
((generic_command
command: (command_name) @_name
arg: (curly_group (_) @markup.italic))
(#eq? @_name "\\emph"))
4 years ago
((generic_command
command: (command_name) @_name
arg: (curly_group (_) @markup.italic))
(#match? @_name "^(\\\\textit|\\\\mathit)$"))
4 years ago
((generic_command
command: (command_name) @_name
arg: (curly_group (_) @markup.bold))
(#match? @_name "^(\\\\textbf|\\\\mathbf)$"))
4 years ago
((generic_command
command: (command_name) @_name
4 years ago
.
arg: (curly_group (_) @markup.link.uri))
(#match? @_name "^(\\\\url|\\\\href)$"))
;; File inclusion commands
(class_include
command: _ @keyword.storage.type
path: (curly_group_path) @string)
(package_include
command: _ @keyword.storage.type
paths: (curly_group_path_list) @string)
(latex_include
command: _ @keyword.control.import
path: (curly_group_path) @string)
(import_include
command: _ @keyword.control.import
directory: (curly_group_path) @string
file: (curly_group_path) @string)
(bibtex_include
command: _ @keyword.control.import
path: (curly_group_path) @string)
(biblatex_include
"\\addbibresource" @include
glob: (curly_group_glob_pattern) @string.regex)
(graphics_include
command: _ @keyword.control.import
path: (curly_group_path) @string)
(tikz_library_import
command: _ @keyword.control.import
paths: (curly_group_path_list) @string)