2021-02-23 22:24:10 +03:00
{
"name" : "typst" ,
"patterns" : [
{ "include" : "#markup" }
] ,
"repository" : {
2022-09-19 12:05:25 +03:00
"comments" : {
2021-02-23 22:24:10 +03:00
"patterns" : [
{
"name" : "comment.block.typst" ,
"begin" : "/\\*" ,
"end" : "\\*/" ,
"captures" : { "0" : { "name" : "punctuation.definition.comment.typst" } } ,
2022-09-19 12:05:25 +03:00
"patterns" : [ { "include" : "#comments" } ]
} ,
{
"name" : "comment.line.double-slash.typst" ,
"begin" : "(?<!:)//" ,
"end" : "\n" ,
"beginCaptures" : { "0" : { "name" : "punctuation.definition.comment.typst" } } ,
"patterns" : [ { "include" : "#comments" } ]
2022-05-14 13:25:19 +03:00
}
]
} ,
"common" : {
"patterns" : [
2023-01-27 13:54:30 +03:00
{ "include" : "#comments" }
2021-02-23 22:24:10 +03:00
]
} ,
"markup" : {
"patterns" : [
{ "include" : "#common" } ,
{
"name" : "constant.character.escape.content.typst" ,
"match" : "\\\\([\\\\/\\[\\]{}#*_=~`$-.]|u\\{[0-9a-zA-Z]*\\}?)"
} ,
{
2022-09-27 17:40:17 +03:00
"name" : "punctuation.definition.linebreak.typst" ,
"match" : "\\\\"
2021-02-23 22:24:10 +03:00
} ,
{
2022-09-27 17:40:17 +03:00
"name" : "punctuation.definition.nonbreaking-space.typst" ,
"match" : "~"
2021-02-23 22:24:10 +03:00
} ,
{
2022-09-27 17:40:17 +03:00
"name" : "punctuation.definition.shy.typst" ,
"match" : "-\\?"
2021-02-23 22:24:10 +03:00
} ,
{
"name" : "punctuation.definition.em-dash.typst" ,
"match" : "---"
} ,
{
"name" : "punctuation.definition.en-dash.typst" ,
"match" : "--"
} ,
{
2022-09-27 17:40:17 +03:00
"name" : "punctuation.definition.ellipsis.typst" ,
"match" : "\\.\\.\\."
2021-02-23 22:24:10 +03:00
} ,
2022-12-05 14:25:37 +03:00
{
"name" : "constant.symbol.typst" ,
"match" : ":([a-zA-Z0-9]+:)+"
} ,
2021-02-23 22:24:10 +03:00
{
2022-09-27 17:40:17 +03:00
"name" : "markup.bold.typst" ,
"begin" : "(^\\*|\\*$|((?<=\\W|_)\\*)|(\\*(?=\\W|_)))" ,
"end" : "(^\\*|\\*$|((?<=\\W|_)\\*)|(\\*(?=\\W|_)))|\n|(?=\\])" ,
"captures" : { "0" : { "name" : "punctuation.definition.bold.typst" } } ,
2021-02-23 22:24:10 +03:00
"patterns" : [ { "include" : "#markup" } ]
} ,
{
2022-09-27 17:40:17 +03:00
"name" : "markup.italic.typst" ,
"begin" : "(^_|_$|((?<=\\W|_)_)|(_(?=\\W|_)))" ,
"end" : "(^_|_$|((?<=\\W|_)_)|(_(?=\\W|_)))|\n|(?=\\])" ,
"captures" : { "0" : { "name" : "punctuation.definition.italic.typst" } } ,
"patterns" : [ { "include" : "#markup" } ]
2021-02-23 22:24:10 +03:00
} ,
{
2022-09-27 17:40:17 +03:00
"name" : "markup.underline.link.typst" ,
"match" : "https?://[0-9a-zA-Z~/%#&=',;\\.\\+\\?]*"
2021-02-23 22:24:10 +03:00
} ,
{
"name" : "markup.raw.block.typst" ,
"begin" : "`{3,}" ,
"end" : "\\0" ,
"captures" : { "0" : { "name" : "punctuation.definition.raw.typst" } }
} ,
{
"name" : "markup.raw.inline.typst" ,
"begin" : "`" ,
"end" : "`" ,
"captures" : { "0" : { "name" : "punctuation.definition.raw.typst" } }
} ,
{
2021-10-25 14:45:54 +03:00
"name" : "string.other.math.typst" ,
"begin" : "\\$" ,
"end" : "\\$" ,
Fix typos (#115)
Found via `codespell -S target -L
crate,ist,thi,alle,dedented,ue,tung,nd,ende,overriden,dependant`
2023-03-22 11:02:51 +03:00
"captures" : { "0" : { "name" : "punctuation.definition.string.math.typst" } }
2021-02-23 22:24:10 +03:00
} ,
2022-08-27 21:26:35 +03:00
{
2022-09-27 17:40:17 +03:00
"name" : "markup.heading.typst" ,
"contentName" : "entity.name.section.typst" ,
"begin" : "^\\s*=+\\s+" ,
"end" : "\n|(?=<)" ,
"beginCaptures" : { "0" : { "name" : "punctuation.definition.heading.typst" } } ,
"patterns" : [ { "include" : "#markup" } ]
} ,
{
"name" : "punctuation.definition.list.unnumbered.typst" ,
"match" : "^\\s*-\\s+"
} ,
{
"name" : "punctuation.definition.list.numbered.typst" ,
"match" : "^\\s*([0-9]*\\.|\\+)\\s+"
} ,
{
"match" : "^\\s*(/)\\s+([^:]*:)" ,
"captures" : {
"1" : { "name" : "punctuation.definition.list.description.typst" } ,
"2" : { "name" : "markup.list.term.typst" }
}
2022-08-27 21:26:35 +03:00
} ,
{
"name" : "entity.other.label.typst" ,
"match" : "<[[:alpha:]_][[:alnum:]_-]*>" ,
"captures" : { "1" : { "name" : "punctuation.definition.label.typst" } }
} ,
2022-09-27 17:40:17 +03:00
{
"name" : "entity.other.reference.typst" ,
"match" : "(@)[[:alpha:]_][[:alnum:]_-]*" ,
"captures" : { "1" : { "name" : "punctuation.definition.reference.typst" } }
} ,
2021-02-23 22:24:10 +03:00
{
2024-02-27 13:05:16 +03:00
"begin" : "(#)(let|set|show|context)\\b" ,
2021-10-25 14:45:54 +03:00
"end" : "\n|(;)|(?=])" ,
2021-02-23 22:24:10 +03:00
"beginCaptures" : {
"0" : { "name" : "keyword.other.typst" } ,
"1" : { "name" : "punctuation.definition.keyword.typst" }
} ,
"endCaptures" : { "1" : { "name" : "punctuation.terminator.statement.typst" } } ,
"patterns" : [ { "include" : "#code" } ]
} ,
2021-10-25 14:45:54 +03:00
{
"name" : "keyword.other.typst" ,
2023-01-20 16:14:13 +03:00
"match" : "(#)(as|in)\\b" ,
2021-10-25 14:45:54 +03:00
"captures" : { "1" : { "name" : "punctuation.definition.keyword.typst" } }
} ,
2021-02-23 22:24:10 +03:00
{
2021-09-30 19:28:25 +03:00
"begin" : "((#)if|(?<=(}|])\\s*)else)\\b" ,
2021-02-23 22:24:10 +03:00
"end" : "\n|(?=])|(?<=}|])" ,
"beginCaptures" : {
"0" : { "name" : "keyword.control.conditional.typst" } ,
2021-09-30 19:28:25 +03:00
"2" : { "name" : "punctuation.definition.keyword.typst" }
2021-02-23 22:24:10 +03:00
} ,
"patterns" : [ { "include" : "#code" } ]
} ,
{
2021-03-17 16:47:11 +03:00
"begin" : "(#)(for|while)\\b" ,
2021-02-23 22:24:10 +03:00
"end" : "\n|(?=])|(?<=}|])" ,
"beginCaptures" : {
2021-10-25 14:45:54 +03:00
"0" : { "name" : "keyword.control.loop.typst" } ,
2021-02-23 22:24:10 +03:00
"1" : { "name" : "punctuation.definition.keyword.typst" }
} ,
"patterns" : [ { "include" : "#code" } ]
} ,
{
2021-10-25 14:45:54 +03:00
"name" : "keyword.control.loop.typst" ,
"match" : "(#)(break|continue)\\b" ,
"captures" : { "1" : { "name" : "punctuation.definition.keyword.typst" } }
} ,
{
2022-10-28 17:49:41 +03:00
"begin" : "(#)(import|include|export)\\b" ,
2021-10-25 14:45:54 +03:00
"end" : "\n|(;)|(?=])" ,
2021-02-23 22:24:10 +03:00
"beginCaptures" : {
"0" : { "name" : "keyword.control.import.typst" } ,
"1" : { "name" : "punctuation.definition.keyword.typst" }
} ,
2021-10-25 14:45:54 +03:00
"endCaptures" : { "1" : { "name" : "punctuation.terminator.statement.typst" } } ,
2021-02-23 22:24:10 +03:00
"patterns" : [ { "include" : "#code" } ]
} ,
2021-05-29 13:25:10 +03:00
{
2021-10-25 14:45:54 +03:00
"name" : "keyword.control.flow.typst" ,
"match" : "(#)(return)\\b" ,
"captures" : { "1" : { "name" : "punctuation.definition.keyword.typst" } }
2021-05-29 13:25:10 +03:00
} ,
2021-02-23 22:24:10 +03:00
{
"comment" : "Function name" ,
"name" : "entity.name.function.typst" ,
2022-03-19 01:36:18 +03:00
"match" : "((#)[[:alpha:]_][[:alnum:]_-]*!?)(?=\\[|\\()" ,
2021-02-23 22:24:10 +03:00
"captures" : { "2" : { "name" : "punctuation.definition.function.typst" } }
} ,
{
"comment" : "Function arguments" ,
2022-03-19 01:36:18 +03:00
"begin" : "(?<=#[[:alpha:]_][[:alnum:]_-]*!?)\\(" ,
2021-02-23 22:24:10 +03:00
"end" : "\\)" ,
2021-03-02 17:37:16 +03:00
"captures" : { "0" : { "name" : "punctuation.definition.group.typst" } } ,
2021-02-23 22:24:10 +03:00
"patterns" : [ { "include" : "#arguments" } ]
} ,
{
2022-05-04 23:14:57 +03:00
"name" : "entity.other.interpolated.typst" ,
2023-01-27 13:54:30 +03:00
"match" : "(#)[[:alpha:]_][.[:alnum:]_-]*" ,
2021-02-23 22:24:10 +03:00
"captures" : { "1" : { "name" : "punctuation.definition.variable.typst" } }
2023-01-27 13:54:30 +03:00
} ,
{
"name" : "meta.block.content.typst" ,
"begin" : "#" ,
"end" : "\\s" ,
"patterns" : [ { "include" : "#code" } ]
2021-02-23 22:24:10 +03:00
}
]
} ,
"code" : {
"patterns" : [
{ "include" : "#common" } ,
2023-01-27 13:54:30 +03:00
{
"name" : "meta.block.code.typst" ,
"begin" : "{" ,
"end" : "}" ,
"captures" : { "0" : { "name" : "punctuation.definition.block.code.typst" } } ,
"patterns" : [ { "include" : "#code" } ]
} ,
{
"name" : "meta.block.content.typst" ,
"begin" : "\\[" ,
"end" : "\\]" ,
"captures" : { "0" : { "name" : "punctuation.definition.block.content.typst" } } ,
"patterns" : [ { "include" : "#markup" } ]
} ,
2021-07-08 20:37:38 +03:00
{
"name" : "comment.line.double-slash.typst" ,
"begin" : "//" ,
"end" : "\n" ,
"beginCaptures" : { "0" : { "name" : "punctuation.definition.comment.typst" } }
} ,
2021-02-23 22:24:10 +03:00
{
"name" : "punctuation.separator.colon.typst" ,
"match" : ":"
} ,
{
"name" : "punctuation.separator.comma.typst" ,
"match" : ","
} ,
{
"name" : "keyword.operator.typst" ,
"match" : "=>|\\.\\."
} ,
{
"name" : "keyword.operator.relational.typst" ,
"match" : "==|!=|<=|<|>=|>"
} ,
{
"name" : "keyword.operator.assignment.typst" ,
"match" : "\\+=|-=|\\*=|/=|="
} ,
{
"name" : "keyword.operator.arithmetic.typst" ,
2022-03-19 01:36:18 +03:00
"match" : "\\+|\\*|/|(?<![[:alpha:]_][[:alnum:]_-]*)-(?![:alnum:]_-]*[[:alpha:]_])"
2021-02-23 22:24:10 +03:00
} ,
{
"name" : "keyword.operator.word.typst" ,
"match" : "\\b(and|or|not)\\b"
} ,
{
2021-10-25 14:45:54 +03:00
"name" : "keyword.other.typst" ,
2024-02-27 13:05:16 +03:00
"match" : "\\b(let|as|in|set|show|context)\\b"
2021-02-23 22:24:10 +03:00
} ,
{
2021-10-25 14:45:54 +03:00
"name" : "keyword.control.conditional.typst" ,
"match" : "\\b(if|else)\\b"
} ,
{
"name" : "keyword.control.loop.typst" ,
"match" : "\\b(for|while|break|continue)\\b"
} ,
{
"name" : "keyword.control.import.typst" ,
2022-10-28 17:49:41 +03:00
"match" : "\\b(import|include|export)\\b"
2021-10-25 14:45:54 +03:00
} ,
{
"name" : "keyword.control.flow.typst" ,
"match" : "\\b(return)\\b"
2021-02-23 22:24:10 +03:00
} ,
{ "include" : "#constants" } ,
{
"comment" : "Function name" ,
"name" : "entity.name.function.typst" ,
2022-03-19 01:36:18 +03:00
"match" : "\\b[[:alpha:]_][[:alnum:]_-]*!?(?=\\[|\\()"
2021-02-23 22:24:10 +03:00
} ,
2022-11-07 14:21:12 +03:00
{
"comment" : "Function name" ,
"name" : "entity.name.function.typst" ,
2022-11-07 16:30:50 +03:00
"match" : "(?<=\\bshow\\s*)\\b[[:alpha:]_][[:alnum:]_-]*(?=\\s*[:.])"
2022-11-07 14:21:12 +03:00
} ,
2021-02-23 22:24:10 +03:00
{
"comment" : "Function arguments" ,
2022-03-19 01:36:18 +03:00
"begin" : "(?<=\\b[[:alpha:]_][[:alnum:]_-]*!?)\\(" ,
2021-02-23 22:24:10 +03:00
"end" : "\\)" ,
"captures" : { "0" : { "name" : "punctuation.definition.group.typst" } } ,
"patterns" : [ { "include" : "#arguments" } ]
} ,
{
"name" : "variable.other.typst" ,
2022-03-19 01:36:18 +03:00
"match" : "\\b[[:alpha:]_][[:alnum:]_-]*\\b"
2021-03-02 17:37:16 +03:00
} ,
{
"name" : "meta.group.typst" ,
"begin" : "\\(" ,
"end" : "\\)|(?=;)" ,
"captures" : { "0" : { "name" : "punctuation.definition.group.typst" } } ,
"patterns" : [ { "include" : "#code" } ]
2021-02-23 22:24:10 +03:00
}
]
} ,
"constants" : {
"patterns" : [
{
"name" : "constant.language.none.typst" ,
"match" : "\\bnone\\b"
} ,
2021-06-09 15:05:57 +03:00
{
"name" : "constant.language.auto.typst" ,
"match" : "\\bauto\\b"
} ,
2021-02-23 22:24:10 +03:00
{
"name" : "constant.language.boolean.typst" ,
"match" : "\\b(true|false)\\b"
} ,
{
"name" : "constant.numeric.length.typst" ,
"match" : "\\b(\\d*)?\\.?\\d+([eE][+-]?\\d+)?(mm|pt|cm|in|em)\\b"
} ,
{
"name" : "constant.numeric.angle.typst" ,
"match" : "\\b(\\d*)?\\.?\\d+([eE][+-]?\\d+)?(rad|deg)\\b"
} ,
{
"name" : "constant.numeric.percentage.typst" ,
"match" : "\\b(\\d*)?\\.?\\d+([eE][+-]?\\d+)?%"
} ,
2021-06-01 15:56:02 +03:00
{
"name" : "constant.numeric.fr.typst" ,
"match" : "\\b(\\d*)?\\.?\\d+([eE][+-]?\\d+)?fr"
} ,
2021-02-23 22:24:10 +03:00
{
"name" : "constant.numeric.integer.typst" ,
2023-04-04 16:22:48 +03:00
"match" : "\\b(0x[0-9a-zA-Z]+|(0b|0o)?\\d+)\\b"
2021-02-23 22:24:10 +03:00
} ,
{
"name" : "constant.numeric.float.typst" ,
"match" : "\\b(\\d*)?\\.?\\d+([eE][+-]?\\d+)?\\b"
} ,
{
"name" : "string.quoted.double.typst" ,
"begin" : "\"" ,
"end" : "\"" ,
"captures" : { "0" : { "name" : "punctuation.definition.string.typst" } } ,
"patterns" : [ {
"name" : "constant.character.escape.string.typst" ,
"match" : "\\\\([\\\\\"nrt]|u\\{?[0-9a-zA-Z]*\\}?)"
} ]
2022-10-28 17:49:41 +03:00
} ,
{
"name" : "string.other.math.typst" ,
"begin" : "\\$" ,
"end" : "\\$" ,
Fix typos (#115)
Found via `codespell -S target -L
crate,ist,thi,alle,dedented,ue,tung,nd,ende,overriden,dependant`
2023-03-22 11:02:51 +03:00
"captures" : { "0" : { "name" : "punctuation.definition.string.math.typst" } }
2021-02-23 22:24:10 +03:00
}
]
} ,
"arguments" : {
"patterns" : [
{
"name" : "variable.parameter.typst" ,
2022-03-19 01:36:18 +03:00
"match" : "\\b[[:alpha:]_][[:alnum:]_-]*(?=:)"
2021-02-23 22:24:10 +03:00
} ,
{ "include" : "#code" }
]
}
} ,
"scopeName" : "source.typst"
}