diff --git a/packages/tm-grammars/NOTICE b/packages/tm-grammars/NOTICE index 261d3bb..debe93e 100644 --- a/packages/tm-grammars/NOTICE +++ b/packages/tm-grammars/NOTICE @@ -6393,6 +6393,33 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +========================================================================================================= +Files: typst.json +License: https://raw.githubusercontent.com/nvarner/typst-lsp/master/LICENSE-MIT.txt +SPDX: MIT +--------------------------------------------------------------------------------------------------------- +MIT License + +Copyright (c) 2023 Nathan Varner + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + ========================================================================================================= Files: v.json License: https://raw.githubusercontent.com/vlang/vscode-vlang/master/LICENSE diff --git a/packages/tm-grammars/README.md b/packages/tm-grammars/README.md index a95e324..e6c7238 100644 --- a/packages/tm-grammars/README.md +++ b/packages/tm-grammars/README.md @@ -157,7 +157,7 @@ import { grammars } from 'tm-grammars' | `rust` | `rs` | [microsoft/vscode](https://github.com/microsoft/vscode/blob/35d97bc7e439fce0f50f42074041ab2d8571b20a/extensions/rust/syntaxes/rust.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/microsoft/vscode/main/LICENSE.txt) | | 16.77 kB | | `sas` | | [rpardee/sas](https://github.com/rpardee/sas/blob/49f6e733c6c0b918a2a825ca2f63dba704f3e8c0/syntaxes/sas.tmLanguage) | [MIT](https://raw.githubusercontent.com/rpardee/sas/master/LICENSE) | `sql` | 9.31 kB | | `sass` | | [TheRealSyler/vscode-sass-indented](https://github.com/TheRealSyler/vscode-sass-indented/blob/7b0bd6bbbb768c0cf21b2aa0899cb872ee42fd50/syntaxes/sass.tmLanguage.json) | [NOASSERTION](https://raw.githubusercontent.com/TheRealSyler/vscode-sass-indented/master/LICENSE) | | 8.84 kB | -| `scala` | | [scala/vscode-scala-syntax](https://github.com/scala/vscode-scala-syntax/blob/0ee961a552679291fdf41f4070c2766da6b7e0fb/syntaxes/Scala.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/scala/vscode-scala-syntax/main/LICENSE.md) | | 26.79 kB | +| `scala` | | [scala/vscode-scala-syntax](https://github.com/scala/vscode-scala-syntax/blob/1addd66a1bcb65510348ee6dddb5acfcf51f4fba/syntaxes/Scala.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/scala/vscode-scala-syntax/main/LICENSE.md) | | 26.85 kB | | `scheme` | | [sjhuangx/vscode-scheme](https://github.com/sjhuangx/vscode-scheme/blob/4e21683666e1e2edfa21d040ecd427f628e7b5ff/syntaxes/scheme.tmLanguage) | [MIT](https://raw.githubusercontent.com/sjhuangx/vscode-scheme/master/LICENSE.md) | | 8.35 kB | | `scss` | | [microsoft/vscode](https://github.com/microsoft/vscode/blob/cf8d61ebd2f022f4ce8280171f0360d1fe0a206d/extensions/scss/syntaxes/scss.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/microsoft/vscode/main/LICENSE.txt) | `css` | 26.21 kB | | `shaderlab` | `shader` | [microsoft/vscode](https://github.com/microsoft/vscode/blob/8fdf170a0850c1cc027382f31650aaf300d3ae2a/extensions/shaderlab/syntaxes/shaderlab.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/microsoft/vscode/main/LICENSE.txt) | `hlsl` | 5.83 kB | @@ -183,6 +183,7 @@ import { grammars } from 'tm-grammars' | `turtle` | | [stardog-union/stardog-vsc](https://github.com/stardog-union/stardog-vsc/blob/3f1364b08bdbf4b4d77f123682db7d2b708b2f6e/stardog-rdf-grammars/syntaxes/turtle.tmLanguage.json) | | | 3.50 kB | | `twig` | | [mblode/vscode-twig-language-2](https://github.com/mblode/vscode-twig-language-2/blob/82ae07ffe96656181ad8265c1fff008c8d1cdbba/src/syntaxes/twig.tmLanguage) | [MIT](https://raw.githubusercontent.com/mblode/vscode-twig-language-2/master/LICENSE.md) | `css` `javascript` `scss` `php` `python` `ruby` | 20.64 kB | | `typescript` | `ts` | [microsoft/vscode](https://github.com/microsoft/vscode/blob/35d97bc7e439fce0f50f42074041ab2d8571b20a/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/microsoft/vscode/main/LICENSE.txt) | | 177.10 kB | +| `typst` | `typ` | [nvarner/typst-lsp](https://github.com/nvarner/typst-lsp/blob/6972d4b9c2cbcb0551e203067f09ec84ca8f9df3/editors/vscode/typst.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/nvarner/typst-lsp/master/LICENSE-MIT.txt) | | 7.98 kB | | `v` | | [vlang/vscode-vlang](https://github.com/vlang/vscode-vlang/blob/b1f529602bc6536ad8967373302e151e77179598/syntaxes/v.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/vlang/vscode-vlang/master/LICENSE) | | 12.76 kB | | `vb` | `cmd` | [microsoft/vscode](https://github.com/microsoft/vscode/blob/35d97bc7e439fce0f50f42074041ab2d8571b20a/extensions/vb/syntaxes/asp-vb-net.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/microsoft/vscode/main/LICENSE.txt) | | 5.84 kB | | `verilog` | | [mshr-h/vscode-verilog-hdl-support](https://github.com/mshr-h/vscode-verilog-hdl-support/blob/5963f70745bac638a96431176d39c688b35e8b59/syntaxes/verilog.tmLanguage.json) | [MIT](https://raw.githubusercontent.com/mshr-h/vscode-verilog-hdl-support/main/LICENSE) | | 5.55 kB | diff --git a/packages/tm-grammars/grammars/scala.json b/packages/tm-grammars/grammars/scala.json index 06f9a25..12d4491 100644 --- a/packages/tm-grammars/grammars/scala.json +++ b/packages/tm-grammars/grammars/scala.json @@ -572,6 +572,10 @@ "match": "\\b(given)\\b", "name": "keyword.other.import.given.scala" }, + { + "match": "\\s(as)\\s", + "name": "keyword.other.import.as.scala" + }, { "match": "[A-Z\\p{Lt}\\p{Lu}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?", "name": "entity.name.class.import.scala" diff --git a/packages/tm-grammars/grammars/typst.json b/packages/tm-grammars/grammars/typst.json new file mode 100644 index 0000000..cb12d4e --- /dev/null +++ b/packages/tm-grammars/grammars/typst.json @@ -0,0 +1,577 @@ +{ + "displayName": "Typst", + "name": "typst", + "patterns": [ + { + "include": "#markup" + } + ], + "repository": { + "arguments": { + "patterns": [ + { + "match": "\\b[[:alpha:]_][[:alnum:]_-]*(?=:)", + "name": "variable.parameter.typst" + }, + { + "include": "#code" + } + ] + }, + "code": { + "patterns": [ + { + "include": "#common" + }, + { + "begin": "{", + "captures": { + "0": { + "name": "punctuation.definition.block.code.typst" + } + }, + "end": "}", + "name": "meta.block.code.typst", + "patterns": [ + { + "include": "#code" + } + ] + }, + { + "begin": "\\[", + "captures": { + "0": { + "name": "punctuation.definition.block.content.typst" + } + }, + "end": "\\]", + "name": "meta.block.content.typst", + "patterns": [ + { + "include": "#markup" + } + ] + }, + { + "begin": "//", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.typst" + } + }, + "end": "\n", + "name": "comment.line.double-slash.typst" + }, + { + "match": ":", + "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": "entity.other.label.typst" + }, + { + "captures": { + "1": { + "name": "punctuation.definition.reference.typst" + } + }, + "match": "(@)[[:alpha:]_][[:alnum:]_-]*", + "name": "entity.other.reference.typst" + }, + { + "begin": "(#)(let|set|show)\\b", + "beginCaptures": { + "0": { + "name": "keyword.other.typst" + }, + "1": { + "name": "punctuation.definition.keyword.typst" + } + }, + "end": "\n|(;)|(?=])", + "endCaptures": { + "1": { + "name": "punctuation.terminator.statement.typst" + } + }, + "patterns": [ + { + "include": "#code" + } + ] + }, + { + "captures": { + "1": { + "name": "punctuation.definition.keyword.typst" + } + }, + "match": "(#)(as|in)\\b", + "name": "keyword.other.typst" + }, + { + "begin": "((#)if|(?<=(}|])\\s*)else)\\b", + "beginCaptures": { + "0": { + "name": "keyword.control.conditional.typst" + }, + "2": { + "name": "punctuation.definition.keyword.typst" + } + }, + "end": "\n|(?=])|(?<=}|])", + "patterns": [ + { + "include": "#code" + } + ] + }, + { + "begin": "(#)(for|while)\\b", + "beginCaptures": { + "0": { + "name": "keyword.control.loop.typst" + }, + "1": { + "name": "punctuation.definition.keyword.typst" + } + }, + "end": "\n|(?=])|(?<=}|])", + "patterns": [ + { + "include": "#code" + } + ] + }, + { + "captures": { + "1": { + "name": "punctuation.definition.keyword.typst" + } + }, + "match": "(#)(break|continue)\\b", + "name": "keyword.control.loop.typst" + }, + { + "begin": "(#)(import|include|export)\\b", + "beginCaptures": { + "0": { + "name": "keyword.control.import.typst" + }, + "1": { + "name": "punctuation.definition.keyword.typst" + } + }, + "end": "\n|(;)|(?=])", + "endCaptures": { + "1": { + "name": "punctuation.terminator.statement.typst" + } + }, + "patterns": [ + { + "include": "#code" + } + ] + }, + { + "captures": { + "1": { + "name": "punctuation.definition.keyword.typst" + } + }, + "match": "(#)(return)\\b", + "name": "keyword.control.flow.typst" + }, + { + "captures": { + "2": { + "name": "punctuation.definition.function.typst" + } + }, + "comment": "Function name", + "match": "((#)[[:alpha:]_][[:alnum:]_-]*!?)(?=\\[|\\()", + "name": "entity.name.function.typst" + }, + { + "begin": "(?<=#[[:alpha:]_][[:alnum:]_-]*!?)\\(", + "captures": { + "0": { + "name": "punctuation.definition.group.typst" + } + }, + "comment": "Function arguments", + "end": "\\)", + "patterns": [ + { + "include": "#arguments" + } + ] + }, + { + "captures": { + "1": { + "name": "punctuation.definition.variable.typst" + } + }, + "match": "(#)[[:alpha:]_][.[:alnum:]_-]*", + "name": "entity.other.interpolated.typst" + }, + { + "begin": "#", + "end": "\\s", + "name": "meta.block.content.typst", + "patterns": [ + { + "include": "#code" + } + ] + } + ] + } + }, + "scopeName": "source.typst" +} diff --git a/packages/tm-grammars/index.js b/packages/tm-grammars/index.js index 982e683..37eabdf 100644 --- a/packages/tm-grammars/index.js +++ b/packages/tm-grammars/index.js @@ -2205,15 +2205,15 @@ export const grammars = [ source: 'https://github.com/TheRealSyler/vscode-sass-indented/blob/7b0bd6bbbb768c0cf21b2aa0899cb872ee42fd50/syntaxes/sass.tmLanguage.json', }, { - byteSize: 27437, + byteSize: 27499, displayName: 'Scala', - lastUpdate: '2024-02-16T10:50:59Z', + lastUpdate: '2024-02-16T11:15:29Z', license: 'MIT', licenseUrl: 'https://raw.githubusercontent.com/scala/vscode-scala-syntax/main/LICENSE.md', name: 'scala', scopeName: 'source.scala', - sha: '0ee961a552679291fdf41f4070c2766da6b7e0fb', - source: 'https://github.com/scala/vscode-scala-syntax/blob/0ee961a552679291fdf41f4070c2766da6b7e0fb/syntaxes/Scala.tmLanguage.json', + sha: '1addd66a1bcb65510348ee6dddb5acfcf51f4fba', + source: 'https://github.com/scala/vscode-scala-syntax/blob/1addd66a1bcb65510348ee6dddb5acfcf51f4fba/syntaxes/Scala.tmLanguage.json', }, { byteSize: 8548, @@ -2582,6 +2582,20 @@ export const grammars = [ sha: '35d97bc7e439fce0f50f42074041ab2d8571b20a', source: 'https://github.com/microsoft/vscode/blob/35d97bc7e439fce0f50f42074041ab2d8571b20a/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json', }, + { + aliases: [ + 'typ', + ], + byteSize: 8171, + displayName: 'Typst', + lastUpdate: '2023-08-11T05:56:51Z', + license: 'MIT', + licenseUrl: 'https://raw.githubusercontent.com/nvarner/typst-lsp/master/LICENSE-MIT.txt', + name: 'typst', + scopeName: 'source.typst', + sha: '6972d4b9c2cbcb0551e203067f09ec84ca8f9df3', + source: 'https://github.com/nvarner/typst-lsp/blob/6972d4b9c2cbcb0551e203067f09ec84ca8f9df3/editors/vscode/typst.tmLanguage.json', + }, { byteSize: 13070, displayName: 'V', diff --git a/samples/typst.sample b/samples/typst.sample new file mode 100644 index 0000000..43e8ca2 --- /dev/null +++ b/samples/typst.sample @@ -0,0 +1,27 @@ +#set page(width: 10cm, height: auto) +#set heading(numbering: "1.") + += Fibonacci sequence +The Fibonacci sequence is defined through the +recurrence relation $F_n = F_(n-1) + F_(n-2)$. +It can also be expressed in _closed form:_ + +$ F_n = round(1 / sqrt(5) phi.alt^n), quad + phi.alt = (1 + sqrt(5)) / 2 $ + +#let count = 8 +#let nums = range(1, count + 1) +#let fib(n) = ( + if n <= 2 { 1 } + else { fib(n - 1) + fib(n - 2) } +) + +The first #count numbers of the sequence are: + +#align(center, table( + columns: count, + ..nums.map(n => $F_#n$), + ..nums.map(n => str(fib(n))), +)) + +// https://github.com/typst/typst/blob/main/README.md diff --git a/sources-grammars.ts b/sources-grammars.ts index c4f62d6..a2a107b 100644 --- a/sources-grammars.ts +++ b/sources-grammars.ts @@ -836,6 +836,12 @@ export const sourcesCommunity: GrammarSource[] = [ displayName: 'Twig', source: 'https://github.com/mblode/vscode-twig-language-2/blob/master/src/syntaxes/twig.tmLanguage', }, + { + name: 'typst', + displayName: 'Typst', + aliases: ['typ'], + source: 'https://github.com/nvarner/typst-lsp/blob/master/editors/vscode/typst.tmLanguage.json', + }, { name: 'verilog', source: 'https://github.com/mshr-h/vscode-verilog-hdl-support/blob/main/syntaxes/verilog.tmLanguage.json',