Open farinc opened 4 months ago
I was going to ask the same.
I think the only thing to do is to support the "text" class in parserByClass
:
No, I assumed you were using vscode syntax classes, but I see there are custom parsers for each supported value.
Isn't there more performant filters based on syntax scopes so as not to use regexs nor implement yet another parser by hand?
In Typst you have arbitrarily nested code and content blocks. A code block is introduced by #{...}
, but there are also some shortcuts like #func(...)
or #var
or #show: ...
(known as show-rules). Notice that special characters like #
can be escaped as in \#
. Comments are C-style, both //
and /* ... */
. Since the top-level is content, it's probably convenient to match code and comments and treat everything else as the body.
Anyway, I think that a better strategy could be to depend on the Textmate scope, but that may vary with the provider. Currently vanilla VSCode has some support for Typst syntax, but the typst-lsp extension adds additional rules.
I think the addition of Typst support would be great, it being a sort of successor to LaTex with already great support in VS Code. It is also very similar to Markdown.