Skip to content

feat: support Tact 1.6.0 #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 149 additions & 3 deletions package/Tact.sublime-completions
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@
"kind": ["function", "m", "Method"],
"details": "<a href=\"https://docs.tact-lang.org/ref/core-base#self-forward\">Tact Docs</a>"
},
{
"trigger": "SendDefaultMode\tequal to 0",
"contents": "SendDefaultMode",
"kind": ["variable", "c", "Constant"],
"details": "<a href=\"https://docs.tact-lang.org/book/message-mode#base-modes\">Tact Docs</a>"
},
{
"trigger": "SendRemainingValue\tequal to 64",
"contents": "SendRemainingValue",
Expand Down Expand Up @@ -174,6 +180,11 @@
"kind": ["variable", "s", "Struct"],
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced/#parsevaraddress\">Tact Docs</a>"
},
{
"trigger": "BasechainAddress",
"contents": "BasechainAddress",
"kind": ["variable", "s", "Struct"]
},

// Built-in types and serialization options
{
Expand Down Expand Up @@ -357,6 +368,12 @@
"kind": "keyword",
"details": "<a href=\"https://docs.tact-lang.org/book/expressions#initof\">Tact Docs</a>"
},
{
"trigger": "codeOf\tobtain init code",
"contents": "codeOf $0",
"kind": "keyword",
"details": "<a href=\"https://docs.tact-lang.org/book/expressions#codeof\">Tact Docs</a>"
},
{
"trigger": "import\tTact, FunC or standard library",
"contents": "import \"$1\";",
Expand Down Expand Up @@ -557,6 +574,18 @@
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-common#now\">Tact Docs</a>"
},
{
"trigger": "curLt\tcurrent logical time",
"contents": "curLt()",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced#curlt\">Tact Docs</a>"
},
{
"trigger": "blockLt\tcurrent block logical time",
"contents": "blockLt()",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced#blocklt\">Tact Docs</a>"
},
{
"trigger": "myBalance\tremaining balance of the contract",
"contents": "myBalance()",
Expand All @@ -575,6 +604,12 @@
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-common#sender\">Tact Docs</a>"
},
{
"trigger": "contractHash\taccount ID of the contract address",
"contents": "contractHash(${1:code_Cell}, ${2:data_Cell})",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-common#contracthash\">Tact Docs</a>"
},
{
"trigger": "context\treturns Context Struct",
"contents": "context()",
Expand All @@ -587,6 +622,21 @@
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-common#newaddress\">Tact Docs</a>"
},
{
"trigger": "emptyBasechainAddress\taddr_none or Address with a null hash",
"contents": "emptyBasechainAddress()",
"kind": "function"
},
{
"trigger": "newBasechainAddress\tAddress in the chain ID 0",
"contents": "newBasechainAddress(${1:hash_Int})",
"kind": "function"
},
{
"trigger": "contractBasechainAddress\tAddress in the chain ID 0 from StateInit",
"contents": "contractBasechainAddress(${1:StateInit})",
"kind": "function"
},
{
"trigger": "contractAddress\tAddress in chain 0 from StateInit",
"contents": "contractAddress(${1:StateInit})",
Expand All @@ -605,6 +655,24 @@
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-common#send\">Tact Docs</a>"
},
{
"trigger": "message\tsend a message using MessageParameters Struct",
"contents": "message($0)",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-common#message\">Tact Docs</a>"
},
{
"trigger": "deploy\tdeploy a contract using DeployParameters Struct",
"contents": "deploy($0)",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-common#deploy\">Tact Docs</a>"
},
{
"trigger": "cashback\tforward excess funds back",
"contents": "cashback($0)",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-common#cashback\">Tact Docs</a>"
},
{
"trigger": "emit\tsend a message body Cell to the outer world",
"contents": "emit(${1:body_Cell})",
Expand Down Expand Up @@ -676,13 +744,25 @@
"details": "<a href=\"https://docs.tact-lang.org/ref/core-debug#dumpstack\">Tact Docs</a>"
},
{
"trigger": "throw\talias to nativeThrow",
"trigger": "throw\tthrow an exception with exit code Int",
"contents": "throw(${1:code_Int})",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-debug#throw\">Tact Docs</a>"
},
{
"trigger": "nativeThrow\tthrow an exception with exit code Int",
"trigger": "throwIf\tthrow exit code under condition",
"contents": "throwIf(${1:code_Int}, ${2:condition_Bool})",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-debug#throwif\">Tact Docs</a>"
},
{
"trigger": "throwUnless\tthrow exit code unless condition",
"contents": "throwUnless(${1:code_Int}, ${2:condition_Bool})",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-debug#throwunless\">Tact Docs</a>"
},
{
"trigger": "nativeThrow\tdeprecated",
"contents": "nativeThrow(${1:code_Int})",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-debug#nativethrow\">Tact Docs</a>"
Expand Down Expand Up @@ -769,6 +849,48 @@
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-math#pow2\">Tact Docs</a>"
},
{
"trigger": "sqrt\tsqrt of an Int",
"contents": "sqrt(${1:Int})",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-math#sqrt\">Tact Docs</a>"
},
{
"trigger": "sign\tsign of an Int",
"contents": "sign(${1:Int})",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-math#sign\">Tact Docs</a>"
},
{
"trigger": "divc\tx / y",
"contents": "divc(${1:x_Int}, ${2:y_Int})",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-math#divc\">Tact Docs</a>"
},
{
"trigger": "muldivc\t(x * y) / z",
"contents": "muldivc(${1:x_Int}, ${2:y_Int}, ${3:z_Int})",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-math#muldivc\">Tact Docs</a>"
},
{
"trigger": "mulShiftRight\t(x * y) / 2^z",
"contents": "mulShiftRight(${1:x_Int}, ${2:y_Int}, ${3:z_Int})",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-math#mulshiftright\">Tact Docs</a>"
},
{
"trigger": "mulShiftRightRound\t(x * y) / 2^z",
"contents": "mulShiftRightRound(${1:x_Int}, ${2:y_Int}, ${3:z_Int})",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-math#mulshiftround\">Tact Docs</a>"
},
{
"trigger": "mulShiftRightCeil\t(x * y) / 2^z",
"contents": "mulShiftRightCeil(${1:x_Int}, ${2:y_Int}, ${3:z_Int})",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-math#mulshiftceil\">Tact Docs</a>"
},
{
"trigger": "checkSignature\tEd25519 signature check of hash using pubkey",
"contents": "checkSignature(${1:hash_Int}, ${2:signature_Slice}, ${3:pubkey_Int})",
Expand Down Expand Up @@ -895,6 +1017,30 @@
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced#nativereserve\">Tact Docs</a>"
},
{
"trigger": "setGasLimit\tlimit gas to X nanoToncoin",
"contents": "setGasLimit($1)",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced/#setgaslimit\">Tact Docs</a>"
},
{
"trigger": "getSeed\tget seed for RNG",
"contents": "getSeed()",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced/#getseed\">Tact Docs</a>"
},
{
"trigger": "setSeed\tset seed for RNG",
"contents": "setSeed($1)",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced/#setseed\">Tact Docs</a>"
},
{
"trigger": "myCode\tcurrent contract code",
"contents": "myCode()",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced/#mycode\">Tact Docs</a>"
},
{
"trigger": "gasConsumed\tget gas consumed so far",
"contents": "gasConsumed()",
Expand Down Expand Up @@ -942,6 +1088,6 @@
"contents": "myStorageDue()",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced/#mystoragedue\">Tact Docs</a>"
},
}
]
}
6 changes: 3 additions & 3 deletions package/Tact.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@
<key>comment</key>
<string>Other constants from the core library</string>
<key>match</key>
<string>(?&lt;!\.)\b(SendRemainingValue|SendRemainingBalance|SendPayGasSeparately|SendIgnoreErrors|SendBounceIfActionFail|SendDestroyIfZero|SendOnlyEstimateFee|ReserveExact|ReserveAllExcept|ReserveAtMost|ReserveAddOriginalBalance|ReserveInvertSign|ReserveBounceIfActionFail)\b</string>
<string>(?&lt;!\.)\b(SendDefaultMode|SendRemainingValue|SendRemainingBalance|SendPayGasSeparately|SendIgnoreErrors|SendBounceIfActionFail|SendDestroyIfZero|SendOnlyEstimateFee|ReserveExact|ReserveAllExcept|ReserveAtMost|ReserveAddOriginalBalance|ReserveInvertSign|ReserveBounceIfActionFail)\b</string>
<key>name</key>
<string>constant.other.builtin.tact</string>
</dict>
Expand Down Expand Up @@ -619,7 +619,7 @@
<array>
<dict>
<key>match</key>
<string>(?&lt;!\.)\b(as)\s+(coins|remaining|bytes(?:32|64)|int257|u?int(?:25[0-6]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]?))\b</string>
<string>(?&lt;!\.)\b(as)\s+(coins|varu?int(?:32|16)|remaining|bytes(?:32|64)|int257|u?int(?:25[0-6]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]?))\b</string>
<key>captures</key>
<dict>
<key>1</key>
Expand Down Expand Up @@ -660,7 +660,7 @@
<key>comment</key>
<string>Augmented assignment operators</string>
<key>match</key>
<string>(\+=|-=|\*=|/=|%=|\^=|&amp;=|\|=|&lt;&lt;=|&gt;&gt;=)</string>
<string>(\+=|-=|\*=|/=|%=|\^=|&amp;=|\|=|\|\|=|&amp;&amp;=|&lt;&lt;=|&gt;&gt;=)</string>
<key>name</key>
<string>keyword.operator.assignment.tact</string>
</dict>
Expand Down
6 changes: 3 additions & 3 deletions package/Tact.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
},
{
"comment": "Other constants from the core library",
"match": "(?<!\\.)\\b(SendRemainingValue|SendRemainingBalance|SendPayGasSeparately|SendIgnoreErrors|SendBounceIfActionFail|SendDestroyIfZero|SendOnlyEstimateFee|ReserveExact|ReserveAllExcept|ReserveAtMost|ReserveAddOriginalBalance|ReserveInvertSign|ReserveBounceIfActionFail)\\b",
"match": "(?<!\\.)\\b(SendDefaultMode|SendRemainingValue|SendRemainingBalance|SendPayGasSeparately|SendIgnoreErrors|SendBounceIfActionFail|SendDestroyIfZero|SendOnlyEstimateFee|ReserveExact|ReserveAllExcept|ReserveAtMost|ReserveAddOriginalBalance|ReserveInvertSign|ReserveBounceIfActionFail)\\b",
"name": "constant.other.builtin.tact"
},
{
Expand Down Expand Up @@ -404,7 +404,7 @@
"comment": "Serialization",
"patterns": [
{
"match": "(?<!\\.)\\b(as)\\s+(coins|remaining|bytes(?:32|64)|int257|u?int(?:25[0-6]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]?))\\b",
"match": "(?<!\\.)\\b(as)\\s+(coins|varu?int(?:32|16)|remaining|bytes(?:32|64)|int257|u?int(?:25[0-6]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]?))\\b",
"captures": {
"1": {
"name": "keyword.other.as.tact storage.modifier.tact"
Expand All @@ -431,7 +431,7 @@
},
{
"comment": "Augmented assignment operators",
"match": "(\\+=|-=|\\*=|/=|%=|\\^=|&=|\\|=|<<=|>>=)",
"match": "(\\+=|-=|\\*=|/=|%=|\\^=|&=|\\|=|\\|\\|=|&&=|<<=|>>=)",
"name": "keyword.operator.assignment.tact"
},
{
Expand Down
2 changes: 2 additions & 0 deletions tests/syntax_test_const.tact
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ fun builtin() {
// <- constant.other.caps.tact
// ^^^^^^^^^ constant.other.caps.tact

SendDefaultMode;
// <- constant.other.builtin.tact
SendRemainingValue;
// <- constant.other.builtin.tact
SendRemainingBalance;
Expand Down
3 changes: 1 addition & 2 deletions tests/syntax_test_primary_expression.tact
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,8 @@ extends fun c(self: Int, ) {
codeOf Contract;
// <- keyword.operator.new.tact
// ^^^^^^^^ entity.name.type.tact
// ^ punctuation.semi.tact

// NOTE: editing constant.character stuff right now
// consider simplifying capture names there :)
// string
"// \\ \" \n\r \t\v \b\f \u{0} \u{FFFFFF} \u0000 \xFF";
// ^ string.quoted.double.tact punctuation.definition.string.begin.tact
Expand Down
12 changes: 11 additions & 1 deletion tests/syntax_test_struct.tact
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,14 @@ struct Serialization {
// ^^^^^ entity.name.type.tact
payload: Slice as remaining;
// ^^^^^^^^^ entity.name.type.tact
}

v16: Int as varint16;
// ^^^^^^^^ entity.name.type.tact
v32: Int as varint32;
// ^^^^^^^^ entity.name.type.tact

vu16: Int as varuint16;
// ^^^^^^^^^ entity.name.type.tact
vu32: Int as varuint32;
// ^^^^^^^^^ entity.name.type.tact
}