FunC v0.5.0 support, diagnostics, and quickfixes #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
UPD. We decided not to develop FunC, but to fork it and start developing a new language, named TOLK.
See ton-blockchain/ton#1345
This MR introduces FunC v0.5.0 support, a new setting "FunC language level" ("v0.4.x" and "v0.5.x" for now), as well as diagnostics/quickfixes related to language levels.
FunC v0.5.0 brief changelog
//
and/*
is now supported (and preferred), block comments are no longer nestedimpure
has become deprecated, but its antonym keywordpure
is introducedmethod_id
is deprecated, also. It was replaced as too obscure. Now there isget
, written on the left:get int seqno() { ... }
compute-asm-ltr
andallow-post-modification
are deprecated (always on)#pragma remove-unused-functions
& | ^
to more intuitive onesFor detailed description, see the MR to FunC itself: ton-blockchain/ton#1026
IDE plugins (both for JetBrains and VS Code) have to be updated to reflect new syntax and introduce a setting "FunC language level", encoupled with inspections to remove
impure
, replacemethod_id
withget
, etc.What does this MR contain
grammar.js
, whereas files likeparser.c
are auto-generated viatree-sitter generate
. WASM file is generated usingyarn grammar:compile
.grammar/func
totree-sitter-func
folder, let's follow the suggested pattern.By the way, since a new stdlib contains built-in functions, VS Code plugin will no longer treat them as unknown symbols.
FunC language level
To provide better development experience for the end user, there is a new setting:
If "v0.4.x" is selected, new syntax is highlighted as errors. Of course, if a programmer actually uses a new FunC compiler (a latest blueprint version, for example), he has to specify "v0.5.x" in settings, but for old compilers, they are errors, as IDE reports.
Screen.Recording.2024-06-11.at.23.01.21.mov
If "v0.5.x" is selected, then
method_id
is suggested to be replaced byget
,impure
is suggested to be removed, and so on. It's very handy for migrating old code to a new compiler.Screen.Recording.2024-06-11.at.23.04.12.mov
Probably, in the future, the language level for a project can be auto-detected by some heruistics. But for now, a user sets it manually.
Previously, this VS Code extension had no ability of quick fixes. I've implemented a kernel via LSP, which is related to diagnostics. These all will be also useful in the future.
Note, that grammar always parses the latest version of FunC, error highlighting is just done by diagnostics with appropriate messages.
It's supposed, that future changes in the FunC language (v0.6.x, etc.) should also be supported in a similar way.
How to review this pull request?
Chronologically, by commits. Every commit contains a completed feature with green tests.