diff options
| author | Jonáš Dujava <19737748+jdujava@users.noreply.github.com> | 2024-07-22 23:12:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-22 23:12:18 +0200 |
| commit | 4ee9f12ff5352547fea8695fe6899e55293fc837 (patch) | |
| tree | 7f24352387b8fc1a82f71283db40b89622dac83c | |
| parent | fix(install): abort installation using git in active git session (diff) | |
| download | nvim-treesitter-4ee9f12ff5352547fea8695fe6899e55293fc837.tar nvim-treesitter-4ee9f12ff5352547fea8695fe6899e55293fc837.tar.gz nvim-treesitter-4ee9f12ff5352547fea8695fe6899e55293fc837.tar.bz2 nvim-treesitter-4ee9f12ff5352547fea8695fe6899e55293fc837.tar.lz nvim-treesitter-4ee9f12ff5352547fea8695fe6899e55293fc837.tar.xz nvim-treesitter-4ee9f12ff5352547fea8695fe6899e55293fc837.tar.zst nvim-treesitter-4ee9f12ff5352547fea8695fe6899e55293fc837.zip | |
refactor(latex): deduplicate captures, reorder
| -rw-r--r-- | queries/latex/highlights.scm | 76 |
1 files changed, 25 insertions, 51 deletions
diff --git a/queries/latex/highlights.scm b/queries/latex/highlights.scm index 4eb39de87..672111878 100644 --- a/queries/latex/highlights.scm +++ b/queries/latex/highlights.scm @@ -1,17 +1,19 @@ ; General syntax -(command_name) @function +(command_name) @function @nospell + +(caption + command: _ @function) (placeholder) @variable -(text_mode - [ - "\\text" - "\\intertext" - "\\shortintertext" - ] @function) +; Turn spelling on for text +(text) @spell -(caption - command: _ @function) +; \text, \intertext, \shortintertext, ... +(text_mode + command: _ @function @nospell + content: (curly_group + (_) @none @spell)) (key_value_pair key: (_) @variable.parameter @@ -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) |
