aboutsummaryrefslogtreecommitdiffstats
path: root/queries/rst
diff options
context:
space:
mode:
authorPham Huy Hoang <hoangtun0810@gmail.com>2023-05-03 19:07:59 +0900
committerChristian Clason <c.clason@uni-graz.at>2023-08-12 17:34:15 +0200
commit78b54eb7f6a9956d25a3911fa0dfd0cabfe2a4c5 (patch)
tree87bc9ffd574b406ceaeb4ea4c32290e66145f587 /queries/rst
parentfeat!: bump required Nvim version to 0.9.1 (diff)
downloadnvim-treesitter-78b54eb7f6a9956d25a3911fa0dfd0cabfe2a4c5.tar
nvim-treesitter-78b54eb7f6a9956d25a3911fa0dfd0cabfe2a4c5.tar.gz
nvim-treesitter-78b54eb7f6a9956d25a3911fa0dfd0cabfe2a4c5.tar.bz2
nvim-treesitter-78b54eb7f6a9956d25a3911fa0dfd0cabfe2a4c5.tar.lz
nvim-treesitter-78b54eb7f6a9956d25a3911fa0dfd0cabfe2a4c5.tar.xz
nvim-treesitter-78b54eb7f6a9956d25a3911fa0dfd0cabfe2a4c5.tar.zst
nvim-treesitter-78b54eb7f6a9956d25a3911fa0dfd0cabfe2a4c5.zip
chore(injections)!: update injection syntax to 0.9
Since 0.9, @lang syntax is still available as fallback but will soon be deprecated. Because of that, new syntax should be adopted once 0.9 becomes the baseline requirements for nvim-treesitter - update health check - update doc
Diffstat (limited to 'queries/rst')
-rw-r--r--queries/rst/injections.scm35
1 files changed, 22 insertions, 13 deletions
diff --git a/queries/rst/injections.scm b/queries/rst/injections.scm
index 97bd0628a..4fc27225a 100644
--- a/queries/rst/injections.scm
+++ b/queries/rst/injections.scm
@@ -1,9 +1,11 @@
-(doctest_block) @python
+((doctest_block) @injection.content
+ (#set! injection.language "python"))
;; Directives with nested content without arguments nor options
((directive
name: (type) @_type
- body: (body) @rst)
+ body: (body) @injection.content)
+ (#set! injection.language "rst")
(#any-of?
@_type
"attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition"
@@ -15,7 +17,8 @@
;; Directives with nested content without arguments, but with options
((directive
name: (type) @_type
- body: (body (options) (content) @rst))
+ body: (body (options) (content) @injection.content))
+ (#set! injection.language "rst")
(#any-of?
@_type
"attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition"
@@ -24,7 +27,8 @@
;; Directives with nested content with arguments and options
((directive
name: (type) @_type
- body: (body (content) @rst))
+ body: (body (content) @injection.content))
+ (#set! injection.language "rst")
(#any-of?
@_type
"figure"
@@ -35,37 +39,42 @@
;; Special directives
((directive
name: (type) @_type
- body: (body (arguments) @language (content) @content))
+ body: (body (arguments) @injection.language (content) @injection.content))
(#any-of? @_type "code" "code-block" "sourcecode"))
((directive
name: (type) @_type
- body: (body (arguments) @language (content) @content))
+ body: (body (arguments) @injection.language (content) @injection.content))
(#eq? @_type "raw"))
((directive
name: (type) @_type
- body: (body (content) @latex))
+ body: (body (content) @injection.content))
+ (#set! injection.language "latex")
(#eq? @_type "math"))
; TODO: re-add when a parser for csv is added.
; ((directive
; name: (type) @_type
-; body: (body (content) @csv))
+; body: (body (content) @injection.content))
+; (#set! injection.language "csv")
; (#eq? @_type "csv-table"))
;; Special roles - prefix
((interpreted_text
(role) @_role
- "interpreted_text" @latex)
- (#eq? @_role ":math:"))
+ "interpreted_text" @injection.content)
+ (#eq? @_role ":math:")
+ (#set! injection.language "latex"))
;; Special roles - suffix
((interpreted_text
- "interpreted_text" @latex
+ "interpreted_text" @injection.content
(role) @_role)
- (#eq? @_role ":math:"))
+ (#eq? @_role ":math:")
+ (#set! injection.language "latex"))
-(comment) @comment
+((comment) @injection.content
+ (#set! injection.language "comment"))