Open anton-trunov opened 2 months ago
It is possible, but would require some workarounds to fix contexts.
For example, the following is how tree-sitter tries to parse a small snippet of a single statement. Notice, that it fails because of lack of proper context:
And here's when we add more context to the statement, such as the body of a global static function fun _()
. Now, tree-sitter is able to parse everything correctly:
This workaround will make many code snippets a tad more verbose, so there are other approaches trying to pre-process code blocks as if they were encapsulated in global static function bodies in the first place.
Moreover, the TextMate grammar docs are using needs to exist in order for VSCode extension and Sublime Text package to work. So, after a discussion with @anton-trunov we figured, that it's best to improve the current TextMate grammar and make a single upstream source of it, such that tact-docs, tact-vscode, upcoming Sublime Text package, Nujan IDE and others can consume it to get decent syntax highlighting.
Closing this issue as wontfix
, at least for the foreseeable future :)
Closing this issue as wontfix, at least for the foreseeable future :)
Maybe not today or next month, but in a year. Admittedly, we don't the manpower to work on this now. But what if someone from the TON community comes along and gets excited to work on something like this. Especially because we have a grants and bounties program to support community members.
would require some workarounds to fix contexts
We may try to do something like the expandable/collapsible code blocks, as seen in Kotlin docs:
Additionally, and this is well out of scope of this issue, we may try to bring Blueprint test runner (or some other approach) into docs to support running Tact's code blocks directly in docs.
It should be in principle possible, since GitHub uses it in Linguist.
No more regex-based highlighting! :)
This would make things like #183 much easier