nvim-treesitter/queries/typst/highlights.scm

115 lines
1.4 KiB
Scheme
Raw Normal View History

2024-02-16 22:03:00 +03:00
;; comments
2024-02-16 21:07:55 +03:00
(comment) @comment @spell
;; punctuation
2024-02-16 22:03:00 +03:00
[
"#"
] @punctuation.special
[
":"
";"
","
] @punctuation.delimiter
[
"(" ")"
"{" "}"
] @punctuation.bracket
; TODO: context blocks?
[
"["
"]"
] @punctuation.bracket
2024-02-16 21:07:55 +03:00
;; operators
[
"-"
"+"
"*"
"/"
"=="
"!="
"<"
"<="
">"
">="
"="
"in"
"and"
"or"
"not"
2024-02-16 22:03:00 +03:00
] @operator
2024-02-16 21:07:55 +03:00
;; keywords
2024-02-16 22:03:00 +03:00
[
"import"
"include"
] @keyword.import
[
"let"
"set"
"show"
] @keyword
2024-02-16 21:07:55 +03:00
;; control flow
2024-02-16 22:03:00 +03:00
[
"for"
"while"
"break"
"continue"
] @keyword.repeat
[
"if"
"else"
] @keyword.conditional
; special case: #for (ident) in (expr)
(for "in" @keyword.repeat)
2024-02-16 21:07:55 +03:00
;; type literals
(number) @number
(string) @string
(bool) @boolean
2024-02-16 22:03:00 +03:00
2024-02-16 21:07:55 +03:00
;; identifiers
2024-02-16 22:03:00 +03:00
(builtin) @module.builtin
(ident) @constant
2024-02-16 21:07:55 +03:00
;; name-value pairs
(tagged
2024-02-16 22:03:00 +03:00
field: (ident)) @variable.member
2024-02-16 21:07:55 +03:00
;; 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
2024-02-16 22:03:00 +03:00
;; text
(text) @spell
; TODO: use multi level headings
(heading) @markup.heading
(strong) @markup.strong
(emph) @markup.italic
(url) @markup.link.url
2024-02-16 21:07:55 +03:00
;; code blocks
2024-02-16 22:03:00 +03:00
(raw_span) @markup.raw
2024-02-16 21:07:55 +03:00
(raw_span
2024-02-16 22:03:00 +03:00
(blob)) @markup.raw
(raw_blck) @markup.raw
2024-02-16 21:07:55 +03:00
(raw_blck
2024-02-16 22:03:00 +03:00
(blob)) @markup.raw.block
2024-02-16 21:07:55 +03:00
;; refs and labels
2024-02-16 22:03:00 +03:00
(label) @markup.link.label
(ref) @markup.link
2024-02-16 21:07:55 +03:00
2024-02-16 22:03:00 +03:00
;; math
(math) @markup.math