aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2022-04-14 11:06:08 +0200
committerChristian Clason <christian.clason@uni-due.de>2022-04-14 12:02:20 +0200
commit94f19cad29ba172b2efa8011f98b50519145f0f9 (patch)
treed2619140128fcaf0df70d60948901c80fe810e57
parentUpdate lockfile.json (diff)
downloadnvim-treesitter-94f19cad29ba172b2efa8011f98b50519145f0f9.tar
nvim-treesitter-94f19cad29ba172b2efa8011f98b50519145f0f9.tar.gz
nvim-treesitter-94f19cad29ba172b2efa8011f98b50519145f0f9.tar.bz2
nvim-treesitter-94f19cad29ba172b2efa8011f98b50519145f0f9.tar.lz
nvim-treesitter-94f19cad29ba172b2efa8011f98b50519145f0f9.tar.xz
nvim-treesitter-94f19cad29ba172b2efa8011f98b50519145f0f9.tar.zst
nvim-treesitter-94f19cad29ba172b2efa8011f98b50519145f0f9.zip
latex: update queries
Make use of parser updates * add `\{re}newenvironment` * add `\DeclarePairedDelimiter{X}` * add `\title` and `\author` * add optional arguments to sectioning commands * use builtin nodes for math environments
-rw-r--r--queries/latex/folds.scm1
-rw-r--r--queries/latex/highlights.scm102
2 files changed, 42 insertions, 61 deletions
diff --git a/queries/latex/folds.scm b/queries/latex/folds.scm
index 6769b2e6a..07505c375 100644
--- a/queries/latex/folds.scm
+++ b/queries/latex/folds.scm
@@ -8,6 +8,7 @@
(subparagraph)
(generic_environment)
+ (math_environment)
(comment_environment)
(displayed_equation)
] @fold
diff --git a/queries/latex/highlights.scm b/queries/latex/highlights.scm
index bfa3edbc6..e1772ca16 100644
--- a/queries/latex/highlights.scm
+++ b/queries/latex/highlights.scm
@@ -32,35 +32,11 @@
;; General environments
(begin
command: _ @text.environment
- name: (curly_group_text
- (text) @text.environment.name)
- (#not-any-of? @text.environment.name
- "displaymath" "displaymath*"
- "equation" "equation*"
- "multline" "multline*"
- "eqnarray" "eqnarray*"
- "align" "align*"
- "array" "array*"
- "split" "split*"
- "alignat" "alignat*"
- "gather" "gather*"
- "flalign" "flalign*"))
+ name: (curly_group_text (text) @text.environment.name))
(end
command: _ @text.environment
- name: (curly_group_text
- (text) @text.environment.name)
- (#not-any-of? @text.environment.name
- "displaymath" "displaymath*"
- "equation" "equation*"
- "multline" "multline*"
- "eqnarray" "eqnarray*"
- "align" "align*"
- "array" "array*"
- "split" "split*"
- "alignat" "alignat*"
- "gather" "gather*"
- "flalign" "flalign*"))
+ name: (curly_group_text (text) @text.environment.name))
;; Definitions and references
(new_command_definition
@@ -73,10 +49,18 @@
command: _ @function.macro
declaration: (_) @function)
+(environment_definition
+ command: _ @function.macro
+ name: (curly_group_text (_) @text.reference))
+
(theorem_definition
command: _ @function.macro
name: (curly_group_text (_) @text.environment.name))
+(paired_delimiter_definition
+ command: _ @function.macro
+ declaration: (curly_group_command_name (_) @function))
+
(label_definition
command: _ @function.macro
name: (curly_group_text (_) @text.reference))
@@ -121,69 +105,65 @@
[
(displayed_equation)
(inline_formula)
+ (math_set)
] @text.math
-((generic_environment
+(math_environment
(begin
command: _ @text.math
- name: (curly_group_text
- (text) @_env))) @text.math
- (#any-of? @_env
- "displaymath" "displaymath*"
- "equation" "equation*"
- "multline" "multline*"
- "eqnarray" "eqnarray*"
- "align" "align*"
- "array" "array*"
- "split" "split*"
- "alignat" "alignat*"
- "gather" "gather*"
- "flalign" "flalign*"))
-((generic_environment
+ name: (curly_group_text (text) @text.math)))
+
+(math_environment
(end
command: _ @text.math
- name: (curly_group_text
- (text) @_env))) @text.math
- (#any-of? @_env
- "displaymath" "displaymath*"
- "equation" "equation*"
- "multline" "multline*"
- "eqnarray" "eqnarray*"
- "align" "align*"
- "array" "array*"
- "split" "split*"
- "alignat" "alignat*"
- "gather" "gather*"
- "flalign" "flalign*"))
+ name: (curly_group_text (text) @text.math)))
;; Sectioning
+(title_declaration
+ command: _ @namespace
+ options: (brack_group (_) @text.title)?
+ text: (curly_group (_) @text.title))
+
+(author_declaration
+ command: _ @namespace
+ authors: (curly_group_author_list
+ ((command_name)? @function)
+ ((author)+ @text.title)))
+
(chapter
command: _ @namespace
- text: (curly_group) @text.title)
+ toc: (brack_group (_) @text.title)?
+ text: (curly_group (_) @text.title))
(part
command: _ @namespace
- text: (curly_group) @text.title)
+ toc: (brack_group (_) @text.title)?
+ text: (curly_group (_) @text.title))
(section
command: _ @namespace
- text: (curly_group) @text.title)
+ toc: (brack_group (_) @text.title)?
+ text: (curly_group (_) @text.title))
(subsection
command: _ @namespace
- text: (curly_group) @text.title)
+ toc: (brack_group (_) @text.title)?
+ text: (curly_group (_) @text.title))
(subsubsection
command: _ @namespace
- text: (curly_group) @text.title)
+ toc: (brack_group (_) @text.title)?
+ text: (curly_group (_) @text.title))
(paragraph
command: _ @namespace
- text: (curly_group) @text.title)
+ toc: (brack_group (_) @text.title)?
+ text: (curly_group (_) @text.title))
(subparagraph
command: _ @namespace
- text: (curly_group) @text.title)
+ toc: (brack_group (_) @text.title)?
+ text: (curly_group (_) @text.title))
;; Beamer frames
(generic_environment