aboutsummaryrefslogtreecommitdiffstats
path: root/queries/typst
diff options
context:
space:
mode:
authorRaafat Turki <raafat.turki@proton.me>2024-02-16 22:30:48 +0300
committerAmaan Qureshi <amaanq12@gmail.com>2024-02-18 06:22:47 -0500
commitf85b205e83750af4fd926c6874dfe256e3fa4fb5 (patch)
treefc74d64b19e4c70637980fcbf5f1dd18d625b579 /queries/typst
parentfix(typst): prevent highlighting entire function calls (diff)
downloadnvim-treesitter-f85b205e83750af4fd926c6874dfe256e3fa4fb5.tar
nvim-treesitter-f85b205e83750af4fd926c6874dfe256e3fa4fb5.tar.gz
nvim-treesitter-f85b205e83750af4fd926c6874dfe256e3fa4fb5.tar.bz2
nvim-treesitter-f85b205e83750af4fd926c6874dfe256e3fa4fb5.tar.lz
nvim-treesitter-f85b205e83750af4fd926c6874dfe256e3fa4fb5.tar.xz
nvim-treesitter-f85b205e83750af4fd926c6874dfe256e3fa4fb5.tar.zst
nvim-treesitter-f85b205e83750af4fd926c6874dfe256e3fa4fb5.zip
style(typst): format queries
Diffstat (limited to 'queries/typst')
-rw-r--r--queries/typst/highlights.scm131
-rw-r--r--queries/typst/injections.scm4
2 files changed, 75 insertions, 60 deletions
diff --git a/queries/typst/highlights.scm b/queries/typst/highlights.scm
index 84d751b7d..f6164ca6f 100644
--- a/queries/typst/highlights.scm
+++ b/queries/typst/highlights.scm
@@ -1,114 +1,131 @@
-;; comments
+; comments
(comment) @comment @spell
-;; punctuation
-[
- "#"
- ] @punctuation.special
+; punctuation
+"#" @punctuation.special
+
[
- ":"
- ";"
- ","
- ] @punctuation.delimiter
+ ":"
+ ";"
+ ","
+] @punctuation.delimiter
+
[
- "(" ")"
- "{" "}"
- ] @punctuation.bracket
+ "("
+ ")"
+ "{"
+ "}"
+] @punctuation.bracket
+
; TODO: context blocks?
[
- "["
- "]"
- ] @punctuation.bracket
+ "["
+ "]"
+] @punctuation.bracket
-;; operators
+; operators
[
- "-"
- "+"
- "*"
- "/"
-
- "=="
- "!="
- "<"
- "<="
- ">"
- ">="
-
- "="
+ "-"
+ "+"
+ "*"
+ "/"
+ "=="
+ "!="
+ "<"
+ "<="
+ ">"
+ ">="
+ "="
+ "in"
+ "and"
+ "or"
+ "not"
+] @operator
- "in"
- "and"
- "or"
- "not"
- ] @operator
-
-;; keywords
+; keywords
[
- "import"
- "include"
- ] @keyword.import
+ "import"
+ "include"
+] @keyword.import
+
[
- "let"
- "set"
- "show"
- ] @keyword
+ "let"
+ "set"
+ "show"
+] @keyword
-;; control flow
+; control flow
[
"for"
"while"
"break"
"continue"
] @keyword.repeat
+
[
"if"
"else"
] @keyword.conditional
+
; special case: #for (ident) in (expr)
-(for "in" @keyword.repeat)
+(for
+ "in" @keyword.repeat)
-;; type literals
+; type literals
(number) @number
+
(string) @string
+
(bool) @boolean
-;; identifiers
+; identifiers
(builtin) @module.builtin
+
(ident) @constant
-;; name-value pairs
+; name-value pairs
(tagged
field: (ident)) @variable.member
-;; function definitions, calls, etc.
-;; TODO: support for functions such as #calc.cos, tree view appears as
-;; (call)
-;; item: (field)
-;; (builtin)
+
+; function definitions, calls, etc.
+; TODO: support for functions such as #calc.cos, tree view appears as
+; (call)
+; item: (field)
+; (builtin)
; field: (ident)
(call
item: (builtin) @function.builtin)
+
(call
item: (ident) @function.call)
-;; text
+; text
(text) @spell
+
; TODO: use multi level headings
(heading) @markup.heading
+
(strong) @markup.strong
+
(emph) @markup.italic
+
(url) @markup.link.url
-;; code blocks
+; code blocks
(raw_span) @markup.raw
+
(raw_span
(blob)) @markup.raw
+
(raw_blck) @markup.raw
+
(raw_blck
(blob)) @markup.raw.block
-;; refs and labels
+; refs and labels
(label) @markup.link.label
+
(ref) @markup.link
-;; math
+; math
(math) @markup.math
diff --git a/queries/typst/injections.scm b/queries/typst/injections.scm
index 050826330..2f0e58eb6 100644
--- a/queries/typst/injections.scm
+++ b/queries/typst/injections.scm
@@ -1,4 +1,2 @@
-([
- (comment)
-] @injection.content
+((comment) @injection.content
(#set! injection.language "comment"))