aboutsummaryrefslogtreecommitdiffstats
path: root/queries/typst
diff options
context:
space:
mode:
authorRaafat Turki <raafat.turki@proton.me>2024-02-16 21:07:55 +0300
committerAmaan Qureshi <amaanq12@gmail.com>2024-02-18 06:22:47 -0500
commit2ba58a424cbeeee429abe01440ab32b2fb966d39 (patch)
tree390c6c990bdc4ef20a106fb92a9a60315559929b /queries/typst
parentfeat: add typst parser (diff)
downloadnvim-treesitter-2ba58a424cbeeee429abe01440ab32b2fb966d39.tar
nvim-treesitter-2ba58a424cbeeee429abe01440ab32b2fb966d39.tar.gz
nvim-treesitter-2ba58a424cbeeee429abe01440ab32b2fb966d39.tar.bz2
nvim-treesitter-2ba58a424cbeeee429abe01440ab32b2fb966d39.tar.lz
nvim-treesitter-2ba58a424cbeeee429abe01440ab32b2fb966d39.tar.xz
nvim-treesitter-2ba58a424cbeeee429abe01440ab32b2fb966d39.tar.zst
nvim-treesitter-2ba58a424cbeeee429abe01440ab32b2fb966d39.zip
feat(typst): add highlight queries
Diffstat (limited to 'queries/typst')
-rw-r--r--queries/typst/highlights.scm79
1 files changed, 79 insertions, 0 deletions
diff --git a/queries/typst/highlights.scm b/queries/typst/highlights.scm
new file mode 100644
index 000000000..ffcbd105b
--- /dev/null
+++ b/queries/typst/highlights.scm
@@ -0,0 +1,79 @@
+;; All scopes: comments
+(comment) @comment @spell
+
+;; Code
+;; punctuation
+["#"] @punctuation.special
+[":" ";" ","] @punctuation.delimiter
+["(" ")" "{" "}"] @punctuation.bracket
+;; TODO: context blocks?
+[ "[" "]" ] @punctuation.bracket
+;; operators
+[
+ "-"
+ "+"
+ "*"
+ "/"
+
+ "=="
+ "!="
+ "<"
+ "<="
+ ">"
+ ">="
+
+ "="
+
+ "in"
+ "and"
+ "or"
+ "not"
+] @operator
+;; keywords
+[ "import" "include" ] @include
+[ "let" "set" "show" ] @keyword
+;; control flow
+[ "for" "while" "break" "continue" ] @repeat
+[ "if" "else" ] @conditional
+;; special case: #for (ident) in (expr)
+(for "in" @repeat)
+;; type literals
+(number) @number
+(string) @string
+(bool) @boolean
+;; identifiers
+(builtin) @namespace
+(ident) @identifier
+;; name-value pairs
+(tagged
+ field: (ident)) @field
+;; 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
+(heading) @text.title
+(text) @text
+(strong) @text.strong
+(emph) @text.emph
+(url) @text.uri
+;; code blocks
+(raw_span) @text.literal
+(raw_span
+ (blob)) @text.literal
+(raw_blck) @text.literal
+(raw_blck
+ (blob)) @text.literal.block
+;; refs and labels
+(label) @text.reference
+(ref) @text.reference
+
+;; Math
+(math) @text.math