feat(latex): add counter nodes' highlight rules

This commit is contained in:
Thibault de Villèle
2025-09-05 11:12:12 +02:00
committed by Christian Clason
parent 1b8622a830
commit c41b3b9841
2 changed files with 60 additions and 1 deletions

View File

@@ -1240,7 +1240,7 @@ return {
latex = {
install_info = {
generate = true,
revision = '7af2bf3addcab5ada8843cf08b857daf1799dbd4',
revision = '7e0ecdc02926c7b9b2e0c76003d4fe7b0944f957',
url = 'https://github.com/latex-lsp/tree-sitter-latex',
},
maintainers = { '@theHamsta', '@clason' },

View File

@@ -23,6 +23,9 @@
(curly_group_spec
(text) @variable.parameter)
(curly_group_value
(value_literal) @constant)
(brack_group_argc) @variable.parameter
[
@@ -85,6 +88,54 @@
declaration: (curly_group_command_name
(_) @function))
(counter_declaration
command: _ @function.macro @nospell
counter: (curly_group_word
(word) @variable)
supercounter: (brack_group_word
(word) @variable)?)
(counter_within_declaration
command: _ @function.macro @nospell
counter: (curly_group_word
(word) @variable)
supercounter: (curly_group_word
(word) @variable))
(counter_without_declaration
command: _ @function.macro @nospell
counter: (curly_group_word
(word) @variable)
supercounter: (curly_group_word
(word) @variable))
(counter_value
command: _ @function.macro @nospell
counter: (curly_group_word
(word) @variable))
; The 'value' fields for the two following highlights
; are handled by counter_value and curly_group_value.
(counter_definition
command: _ @function.macro @nospell
counter: (curly_group_word
(word) @variable))
(counter_addition
command: _ @function.macro @nospell
counter: (curly_group_word
(word) @variable))
(counter_increment
command: _ @function.macro @nospell
counter: (curly_group_word
(word) @variable))
(counter_typesetting
command: _ @function.macro @nospell
counter: (curly_group_word
(word) @variable))
(label_definition
command: _ @function.macro
name: (curly_group_label
@@ -298,6 +349,14 @@
; Turn spelling off for whole nodes
[
(counter_declaration)
(counter_within_declaration)
(counter_without_declaration)
(counter_value)
(counter_definition)
(counter_addition)
(counter_increment)
(counter_typesetting)
(label_reference)
(label_reference_range)
(label_number)