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 = { latex = {
install_info = { install_info = {
generate = true, generate = true,
revision = '7af2bf3addcab5ada8843cf08b857daf1799dbd4', revision = '7e0ecdc02926c7b9b2e0c76003d4fe7b0944f957',
url = 'https://github.com/latex-lsp/tree-sitter-latex', url = 'https://github.com/latex-lsp/tree-sitter-latex',
}, },
maintainers = { '@theHamsta', '@clason' }, maintainers = { '@theHamsta', '@clason' },

View file

@ -23,6 +23,9 @@
(curly_group_spec (curly_group_spec
(text) @variable.parameter) (text) @variable.parameter)
(curly_group_value
(value_literal) @constant)
(brack_group_argc) @variable.parameter (brack_group_argc) @variable.parameter
[ [
@ -85,6 +88,54 @@
declaration: (curly_group_command_name declaration: (curly_group_command_name
(_) @function)) (_) @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 (label_definition
command: _ @function.macro command: _ @function.macro
name: (curly_group_label name: (curly_group_label
@ -298,6 +349,14 @@
; Turn spelling off for whole nodes ; 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)
(label_reference_range) (label_reference_range)
(label_number) (label_number)