refactor(latex): deduplicate captures, reorder

This commit is contained in:
Jonáš Dujava 2024-07-22 23:12:18 +02:00 committed by GitHub
parent debf5816ee
commit 4ee9f12ff5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,18 +1,20 @@
; General syntax
(command_name) @function
(placeholder) @variable
(text_mode
[
"\\text"
"\\intertext"
"\\shortintertext"
] @function)
(command_name) @function @nospell
(caption
command: _ @function)
(placeholder) @variable
; Turn spelling on for text
(text) @spell
; \text, \intertext, \shortintertext, ...
(text_mode
command: _ @function @nospell
content: (curly_group
(_) @none @spell))
(key_value_pair
key: (_) @variable.parameter
value: (_))
@ -53,17 +55,13 @@
; Definitions and references
(new_command_definition
command: _ @function.macro
declaration: (curly_group_command_name
(_) @function))
command: _ @function.macro)
(old_command_definition
command: _ @function.macro
declaration: (_) @function)
command: _ @function.macro)
(let_command_definition
command: _ @function.macro
declaration: (_) @function)
command: _ @function.macro)
(environment_definition
command: _ @function.macro
@ -107,6 +105,11 @@
command: _ @function.macro
keys: (curly_group_text_list) @markup.link)
(hyperlink
command: _ @function @nospell
uri: (curly_group_uri
(_) @markup.link.url @nospell))
(glossary_entry_definition
command: _ @function.macro
name: (curly_group_text
@ -137,26 +140,6 @@
name: (curly_group_text
(_) @markup.link))
; Formatting
(text_mode
content: (curly_group
(_) @none @spell))
(math_environment
(begin
command: _ @markup.math
name: (curly_group_text
(_) @markup.math)))
(math_environment
(_) @markup.math)
(math_environment
(end
command: _ @markup.math
name: (curly_group_text
(_) @markup.math)))
; Sectioning
(title_declaration
command: _ @module
@ -232,7 +215,7 @@
((generic_command
command: (command_name) @_name
arg: (curly_group
(text) @markup.heading))
(_) @markup.heading))
(#eq? @_name "\\frametitle"))
((generic_command
@ -247,11 +230,6 @@
(_) @markup.strong))
(#any-of? @_name "\\textbf" "\\mathbf"))
(hyperlink
command: _ @function @nospell
uri: (curly_group_uri
(_) @markup.link.url @nospell))
; File inclusion commands
(class_include
command: _ @keyword.import
@ -302,12 +280,6 @@
command: _ @keyword.import
paths: (curly_group_path_list) @string)
(text) @spell
(inline_formula) @nospell
(displayed_equation) @nospell
(key_value_pair) @nospell
(generic_environment
@ -317,8 +289,6 @@
(citation
keys: _ @nospell)
(command_name) @nospell
(label_definition) @nospell
(label_reference) @nospell
@ -329,8 +299,12 @@
[
(displayed_equation)
(inline_formula)
] @markup.math
] @markup.math @nospell
(math_environment
(_) @markup.math)
; Comments
[
(line_comment)
(block_comment)