aboutsummaryrefslogtreecommitdiffstats
path: root/queries/rst
diff options
context:
space:
mode:
authorPham Huy Hoang <hoangtun0810@gmail.com>2024-01-06 15:05:50 +0900
committerChristian Clason <c.clason@uni-graz.at>2024-01-19 16:58:37 +0100
commit57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9 (patch)
tree70bf645539882b88e6fa129cefd30986b89bbac3 /queries/rst
parentci: add query lint job (diff)
downloadnvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.gz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.bz2
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.lz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.xz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.zst
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.zip
chore: query formatting
Diffstat (limited to 'queries/rst')
-rw-r--r--queries/rst/highlights.scm58
-rw-r--r--queries/rst/injections.scm108
-rw-r--r--queries/rst/locals.scm25
3 files changed, 94 insertions, 97 deletions
diff --git a/queries/rst/highlights.scm b/queries/rst/highlights.scm
index d83a21427..7d667eeea 100644
--- a/queries/rst/highlights.scm
+++ b/queries/rst/highlights.scm
@@ -1,5 +1,4 @@
-;; Marks
-
+; Marks
[
".."
"|"
@@ -14,24 +13,25 @@
"bullet"
"adornment"
] @markup.list
-;; Resets for injection
+; Resets for injection
(doctest_block) @none
-;; Directives
-
+; Directives
(directive
name: (type) @function)
(directive
- body: (body (arguments) @variable.parameter))
+ body:
+ (body
+ (arguments) @variable.parameter))
((directive
name: (type) @keyword.import)
- (#eq? @keyword.import "include"))
+ (#eq? @keyword.import "include"))
((directive
- name: (type) @function.builtin)
+ name: (type) @function.builtin)
; format-ignore
(#any-of? @function.builtin
; https://docutils.sourceforge.io/docs/ref/rst/directives.html
@@ -45,8 +45,7 @@
"replace" "unicode" "date"
"raw" "class" "role" "default-role" "title" "restructuredtext-test-directive"))
-;; Blocks
-
+; Blocks
[
(literal_block)
(line_block)
@@ -68,18 +67,17 @@
name: (name)? @markup.link.label
link: (_)? @markup.link)
-;; Lists
-
+; Lists
; Definition lists
(list_item
(term) @markup.strong
(classifier)? @markup.italic)
; Field lists
-(field (field_name) @constant)
-
-;; Inline markup
+(field
+ (field_name) @constant)
+; Inline markup
(emphasis) @markup.italic
(strong) @markup.strong
@@ -111,7 +109,7 @@
":raw:"))
[
- "interpreted_text"
+ "interpreted_text"
(literal)
] @markup.raw
@@ -119,33 +117,33 @@
((interpreted_text
(role) @_role
"interpreted_text" @markup.italic)
- (#eq? @_role ":emphasis:"))
+ (#eq? @_role ":emphasis:"))
((interpreted_text
(role) @_role
"interpreted_text" @markup.strong)
- (#eq? @_role ":strong:"))
+ (#eq? @_role ":strong:"))
((interpreted_text
(role) @_role
"interpreted_text" @none)
- (#eq? @_role ":math:"))
+ (#eq? @_role ":math:"))
; Suffix role
((interpreted_text
"interpreted_text" @markup.italic
(role) @_role)
- (#eq? @_role ":emphasis:"))
+ (#eq? @_role ":emphasis:"))
((interpreted_text
"interpreted_text" @markup.strong
(role) @_role)
- (#eq? @_role ":strong:"))
+ (#eq? @_role ":strong:"))
((interpreted_text
"interpreted_text" @none
(role) @_role)
- (#eq? @_role ":math:"))
+ (#eq? @_role ":math:"))
[
(inline_target)
@@ -155,17 +153,19 @@
(reference)
] @markup.link @nospell
-;; Others
-
+; Others
(title) @markup.heading
(comment) @comment @spell
-(comment "..") @comment
+
+(comment
+ "..") @comment
(directive
- name: (type) @_directive
- body: (body
- (content) @spell
- (#not-any-of? @_directive "code" "code-block" "sourcecode")))
+ name: (type) @_directive
+ body:
+ (body
+ (content) @spell
+ (#not-any-of? @_directive "code" "code-block" "sourcecode")))
(paragraph) @spell
diff --git a/queries/rst/injections.scm b/queries/rst/injections.scm
index 7155b2a9b..e0bb380d2 100644
--- a/queries/rst/injections.scm
+++ b/queries/rst/injections.scm
@@ -1,80 +1,78 @@
((doctest_block) @injection.content
- (#set! injection.language "python"))
-
-;; Directives with nested content without arguments nor options
+ (#set! injection.language "python"))
+; Directives with nested content without arguments nor options
((directive
- name: (type) @_type
- body: (body) @injection.content)
- (#set! injection.language "rst")
- (#any-of?
- @_type
- "attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition"
- "line-block" "parsed-literal" "epigraph" "highlights" "pull-quote" "compound"
- "header" "footer"
- "meta"
- "replace"))
+ name: (type) @_type
+ body: (body) @injection.content)
+ (#set! injection.language "rst")
+ (#any-of? @_type "attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition" "line-block" "parsed-literal" "epigraph" "highlights" "pull-quote" "compound" "header" "footer" "meta" "replace"))
-;; Directives with nested content without arguments, but with options
+; Directives with nested content without arguments, but with options
((directive
- name: (type) @_type
- body: (body (options) (content) @injection.content))
- (#set! injection.language "rst")
- (#any-of?
- @_type
- "attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition"
- "line-block" "parsed-literal" "compound"))
+ name: (type) @_type
+ body:
+ (body
+ (options)
+ (content) @injection.content))
+ (#set! injection.language "rst")
+ (#any-of? @_type "attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition" "line-block" "parsed-literal" "compound"))
-;; Directives with nested content with arguments and options
+; Directives with nested content with arguments and options
((directive
- name: (type) @_type
- body: (body (content) @injection.content))
- (#set! injection.language "rst")
- (#any-of?
- @_type
- "figure"
- "topic" "sidebar" "container"
- "table" "list-table"
- "class" "role" "restructuredtext-test-directive"))
+ name: (type) @_type
+ body:
+ (body
+ (content) @injection.content))
+ (#set! injection.language "rst")
+ (#any-of? @_type "figure" "topic" "sidebar" "container" "table" "list-table" "class" "role" "restructuredtext-test-directive"))
-;; Special directives
+; Special directives
((directive
- name: (type) @_type
- body: (body (arguments) @injection.language (content) @injection.content))
- (#any-of? @_type "code" "code-block" "sourcecode"))
+ name: (type) @_type
+ body:
+ (body
+ (arguments) @injection.language
+ (content) @injection.content))
+ (#any-of? @_type "code" "code-block" "sourcecode"))
((directive
- name: (type) @_type
- body: (body (arguments) @injection.language (content) @injection.content))
- (#eq? @_type "raw"))
+ name: (type) @_type
+ body:
+ (body
+ (arguments) @injection.language
+ (content) @injection.content))
+ (#eq? @_type "raw"))
((directive
- name: (type) @_type
- body: (body (content) @injection.content))
- (#set! injection.language "latex")
- (#eq? @_type "math"))
+ name: (type) @_type
+ 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) @injection.content))
- (#set! injection.language "csv")
- (#eq? @_type "csv-table"))
-
-;; Special roles - prefix
+ name: (type) @_type
+ body:
+ (body
+ (content) @injection.content))
+ (#set! injection.language "csv")
+ (#eq? @_type "csv-table"))
+; Special roles - prefix
((interpreted_text
(role) @_role
"interpreted_text" @injection.content)
- (#eq? @_role ":math:")
- (#set! injection.language "latex"))
-
-;; Special roles - suffix
+ (#eq? @_role ":math:")
+ (#set! injection.language "latex"))
+; Special roles - suffix
((interpreted_text
"interpreted_text" @injection.content
(role) @_role)
- (#eq? @_role ":math:")
- (#set! injection.language "latex"))
+ (#eq? @_role ":math:")
+ (#set! injection.language "latex"))
((comment) @injection.content
- (#set! injection.language "comment"))
+ (#set! injection.language "comment"))
diff --git a/queries/rst/locals.scm b/queries/rst/locals.scm
index 3091064cb..477c4ef3b 100644
--- a/queries/rst/locals.scm
+++ b/queries/rst/locals.scm
@@ -1,11 +1,9 @@
-;; Scopes
-
+; Scopes
(document) @local.scope
(directive) @local.scope
-;; Definitions
-
+; Definitions
(title) @local.definition
(substitution_definition
@@ -26,15 +24,16 @@
; The role directive can define a new role
((directive
name: (type) @_type
- body: (body (arguments) @local.definition))
- (#eq? @_type "role"))
-
-;; References
+ body:
+ (body
+ (arguments) @local.definition))
+ (#eq? @_type "role"))
+; References
[
- (substitution_reference)
- (footnote_reference)
- (citation_reference)
- (reference)
- (role)
+ (substitution_reference)
+ (footnote_reference)
+ (citation_reference)
+ (reference)
+ (role)
] @local.reference