aboutsummaryrefslogtreecommitdiffstats
path: root/queries/typst
diff options
context:
space:
mode:
authorRaafat Turki <raafat.turki@proton.me>2024-02-16 22:03:00 +0300
committerAmaan Qureshi <amaanq12@gmail.com>2024-02-18 06:22:47 -0500
commitc76e7e2a28d22994293375593f588f006e659f8b (patch)
tree271024574ae04d1c4fc156f5d162b8c6125810d1 /queries/typst
parentfeat(typst): add comment injection (diff)
downloadnvim-treesitter-c76e7e2a28d22994293375593f588f006e659f8b.tar
nvim-treesitter-c76e7e2a28d22994293375593f588f006e659f8b.tar.gz
nvim-treesitter-c76e7e2a28d22994293375593f588f006e659f8b.tar.bz2
nvim-treesitter-c76e7e2a28d22994293375593f588f006e659f8b.tar.lz
nvim-treesitter-c76e7e2a28d22994293375593f588f006e659f8b.tar.xz
nvim-treesitter-c76e7e2a28d22994293375593f588f006e659f8b.tar.zst
nvim-treesitter-c76e7e2a28d22994293375593f588f006e659f8b.zip
fix(typst): correct highlight captures
Diffstat (limited to 'queries/typst')
-rw-r--r--queries/typst/highlights.scm97
1 files changed, 66 insertions, 31 deletions
diff --git a/queries/typst/highlights.scm b/queries/typst/highlights.scm
index ffcbd105b..4c6536899 100644
--- a/queries/typst/highlights.scm
+++ b/queries/typst/highlights.scm
@@ -1,13 +1,25 @@
-;; All scopes: comments
+;; comments
(comment) @comment @spell
-;; Code
;; punctuation
-["#"] @punctuation.special
-[":" ";" ","] @punctuation.delimiter
-["(" ")" "{" "}"] @punctuation.bracket
-;; TODO: context blocks?
-[ "[" "]" ] @punctuation.bracket
+[
+ "#"
+ ] @punctuation.special
+[
+ ":"
+ ";"
+ ","
+ ] @punctuation.delimiter
+[
+ "(" ")"
+ "{" "}"
+ ] @punctuation.bracket
+; TODO: context blocks?
+[
+ "["
+ "]"
+ ] @punctuation.bracket
+
;; operators
[
"-"
@@ -28,25 +40,45 @@
"and"
"or"
"not"
-] @operator
+ ] @operator
+
;; keywords
-[ "import" "include" ] @include
-[ "let" "set" "show" ] @keyword
+[
+ "import"
+ "include"
+ ] @keyword.import
+[
+ "let"
+ "set"
+ "show"
+ ] @keyword
+
;; control flow
-[ "for" "while" "break" "continue" ] @repeat
-[ "if" "else" ] @conditional
-;; special case: #for (ident) in (expr)
-(for "in" @repeat)
+[
+ "for"
+ "while"
+ "break"
+ "continue"
+] @keyword.repeat
+[
+ "if"
+ "else"
+] @keyword.conditional
+; special case: #for (ident) in (expr)
+(for "in" @keyword.repeat)
+
;; type literals
(number) @number
(string) @string
(bool) @boolean
+
;; identifiers
-(builtin) @namespace
-(ident) @identifier
+(builtin) @module.builtin
+(ident) @constant
+
;; name-value pairs
(tagged
- field: (ident)) @field
+ field: (ident)) @variable.member
;; function definitions, calls, etc.
;; TODO: support for functions such as #calc.cos, tree view appears as
;; (call)
@@ -58,22 +90,25 @@
(call
item: (ident)) @function.call
-;; Text
-(heading) @text.title
-(text) @text
-(strong) @text.strong
-(emph) @text.emph
-(url) @text.uri
+;; text
+(text) @spell
+; TODO: use multi level headings
+(heading) @markup.heading
+(strong) @markup.strong
+(emph) @markup.italic
+(url) @markup.link.url
+
;; code blocks
-(raw_span) @text.literal
+(raw_span) @markup.raw
(raw_span
- (blob)) @text.literal
-(raw_blck) @text.literal
+ (blob)) @markup.raw
+(raw_blck) @markup.raw
(raw_blck
- (blob)) @text.literal.block
+ (blob)) @markup.raw.block
+
;; refs and labels
-(label) @text.reference
-(ref) @text.reference
+(label) @markup.link.label
+(ref) @markup.link
-;; Math
-(math) @text.math
+;; math
+(math) @markup.math