mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-15 18:00:07 -04:00
fix(typst): correct highlight captures
This commit is contained in:
parent
b3847b9551
commit
c76e7e2a28
1 changed files with 70 additions and 35 deletions
|
|
@ -1,13 +1,25 @@
|
||||||
;; All scopes: comments
|
;; comments
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
||||||
;; Code
|
|
||||||
;; punctuation
|
;; punctuation
|
||||||
["#"] @punctuation.special
|
[
|
||||||
[":" ";" ","] @punctuation.delimiter
|
"#"
|
||||||
["(" ")" "{" "}"] @punctuation.bracket
|
] @punctuation.special
|
||||||
;; TODO: context blocks?
|
[
|
||||||
[ "[" "]" ] @punctuation.bracket
|
":"
|
||||||
|
";"
|
||||||
|
","
|
||||||
|
] @punctuation.delimiter
|
||||||
|
[
|
||||||
|
"(" ")"
|
||||||
|
"{" "}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
; TODO: context blocks?
|
||||||
|
[
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
;; operators
|
;; operators
|
||||||
[
|
[
|
||||||
"-"
|
"-"
|
||||||
|
|
@ -28,25 +40,45 @@
|
||||||
"and"
|
"and"
|
||||||
"or"
|
"or"
|
||||||
"not"
|
"not"
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
;; keywords
|
;; keywords
|
||||||
[ "import" "include" ] @include
|
[
|
||||||
[ "let" "set" "show" ] @keyword
|
"import"
|
||||||
|
"include"
|
||||||
|
] @keyword.import
|
||||||
|
[
|
||||||
|
"let"
|
||||||
|
"set"
|
||||||
|
"show"
|
||||||
|
] @keyword
|
||||||
|
|
||||||
;; control flow
|
;; control flow
|
||||||
[ "for" "while" "break" "continue" ] @repeat
|
[
|
||||||
[ "if" "else" ] @conditional
|
"for"
|
||||||
;; special case: #for (ident) in (expr)
|
"while"
|
||||||
(for "in" @repeat)
|
"break"
|
||||||
|
"continue"
|
||||||
|
] @keyword.repeat
|
||||||
|
[
|
||||||
|
"if"
|
||||||
|
"else"
|
||||||
|
] @keyword.conditional
|
||||||
|
; special case: #for (ident) in (expr)
|
||||||
|
(for "in" @keyword.repeat)
|
||||||
|
|
||||||
;; type literals
|
;; type literals
|
||||||
(number) @number
|
(number) @number
|
||||||
(string) @string
|
(string) @string
|
||||||
(bool) @boolean
|
(bool) @boolean
|
||||||
|
|
||||||
;; identifiers
|
;; identifiers
|
||||||
(builtin) @namespace
|
(builtin) @module.builtin
|
||||||
(ident) @identifier
|
(ident) @constant
|
||||||
|
|
||||||
;; name-value pairs
|
;; name-value pairs
|
||||||
(tagged
|
(tagged
|
||||||
field: (ident)) @field
|
field: (ident)) @variable.member
|
||||||
;; function definitions, calls, etc.
|
;; function definitions, calls, etc.
|
||||||
;; TODO: support for functions such as #calc.cos, tree view appears as
|
;; TODO: support for functions such as #calc.cos, tree view appears as
|
||||||
;; (call)
|
;; (call)
|
||||||
|
|
@ -58,22 +90,25 @@
|
||||||
(call
|
(call
|
||||||
item: (ident)) @function.call
|
item: (ident)) @function.call
|
||||||
|
|
||||||
;; Text
|
;; text
|
||||||
(heading) @text.title
|
(text) @spell
|
||||||
(text) @text
|
; TODO: use multi level headings
|
||||||
(strong) @text.strong
|
(heading) @markup.heading
|
||||||
(emph) @text.emph
|
(strong) @markup.strong
|
||||||
(url) @text.uri
|
(emph) @markup.italic
|
||||||
;; code blocks
|
(url) @markup.link.url
|
||||||
(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
|
;; code blocks
|
||||||
(math) @text.math
|
(raw_span) @markup.raw
|
||||||
|
(raw_span
|
||||||
|
(blob)) @markup.raw
|
||||||
|
(raw_blck) @markup.raw
|
||||||
|
(raw_blck
|
||||||
|
(blob)) @markup.raw.block
|
||||||
|
|
||||||
|
;; refs and labels
|
||||||
|
(label) @markup.link.label
|
||||||
|
(ref) @markup.link
|
||||||
|
|
||||||
|
;; math
|
||||||
|
(math) @markup.math
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue