diff options
| author | Thibault de Villèle <25150288+Thibaulltt@users.noreply.github.com> | 2025-09-05 11:12:12 +0200 |
|---|---|---|
| committer | Christian Clason <ch.clason+github@icloud.com> | 2025-09-19 10:35:18 +0200 |
| commit | c41b3b9841588e956663345cf01842a232d5eece (patch) | |
| tree | 12fbc03f577554994f02c3f60119099b36313fe2 | |
| parent | feat(latex)!: update parser and queries (diff) | |
| download | nvim-treesitter-c41b3b9841588e956663345cf01842a232d5eece.tar nvim-treesitter-c41b3b9841588e956663345cf01842a232d5eece.tar.gz nvim-treesitter-c41b3b9841588e956663345cf01842a232d5eece.tar.bz2 nvim-treesitter-c41b3b9841588e956663345cf01842a232d5eece.tar.lz nvim-treesitter-c41b3b9841588e956663345cf01842a232d5eece.tar.xz nvim-treesitter-c41b3b9841588e956663345cf01842a232d5eece.tar.zst nvim-treesitter-c41b3b9841588e956663345cf01842a232d5eece.zip | |
feat(latex): add counter nodes' highlight rules
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 2 | ||||
| -rw-r--r-- | runtime/queries/latex/highlights.scm | 59 |
2 files changed, 60 insertions, 1 deletions
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 8ea842356..16d575512 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -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' }, diff --git a/runtime/queries/latex/highlights.scm b/runtime/queries/latex/highlights.scm index 30602c907..3f195a13e 100644 --- a/runtime/queries/latex/highlights.scm +++ b/runtime/queries/latex/highlights.scm @@ -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) |
