Skip to content

Commit f67906d

Browse files
authored
feat: support Tact 1.6.0 (#33)
1 parent 8d2deb1 commit f67906d

File tree

6 files changed

+169
-12
lines changed

6 files changed

+169
-12
lines changed

package/Tact.sublime-completions

Lines changed: 149 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@
7070
"kind": ["function", "m", "Method"],
7171
"details": "<a href=\"https://docs.tact-lang.org/ref/core-base#self-forward\">Tact Docs</a>"
7272
},
73+
{
74+
"trigger": "SendDefaultMode\tequal to 0",
75+
"contents": "SendDefaultMode",
76+
"kind": ["variable", "c", "Constant"],
77+
"details": "<a href=\"https://docs.tact-lang.org/book/message-mode#base-modes\">Tact Docs</a>"
78+
},
7379
{
7480
"trigger": "SendRemainingValue\tequal to 64",
7581
"contents": "SendRemainingValue",
@@ -174,6 +180,11 @@
174180
"kind": ["variable", "s", "Struct"],
175181
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced/#parsevaraddress\">Tact Docs</a>"
176182
},
183+
{
184+
"trigger": "BasechainAddress",
185+
"contents": "BasechainAddress",
186+
"kind": ["variable", "s", "Struct"]
187+
},
177188

178189
// Built-in types and serialization options
179190
{
@@ -357,6 +368,12 @@
357368
"kind": "keyword",
358369
"details": "<a href=\"https://docs.tact-lang.org/book/expressions#initof\">Tact Docs</a>"
359370
},
371+
{
372+
"trigger": "codeOf\tobtain init code",
373+
"contents": "codeOf $0",
374+
"kind": "keyword",
375+
"details": "<a href=\"https://docs.tact-lang.org/book/expressions#codeof\">Tact Docs</a>"
376+
},
360377
{
361378
"trigger": "import\tTact, FunC or standard library",
362379
"contents": "import \"$1\";",
@@ -557,6 +574,18 @@
557574
"kind": "function",
558575
"details": "<a href=\"https://docs.tact-lang.org/ref/core-common#now\">Tact Docs</a>"
559576
},
577+
{
578+
"trigger": "curLt\tcurrent logical time",
579+
"contents": "curLt()",
580+
"kind": "function",
581+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced#curlt\">Tact Docs</a>"
582+
},
583+
{
584+
"trigger": "blockLt\tcurrent block logical time",
585+
"contents": "blockLt()",
586+
"kind": "function",
587+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced#blocklt\">Tact Docs</a>"
588+
},
560589
{
561590
"trigger": "myBalance\tremaining balance of the contract",
562591
"contents": "myBalance()",
@@ -575,6 +604,12 @@
575604
"kind": "function",
576605
"details": "<a href=\"https://docs.tact-lang.org/ref/core-common#sender\">Tact Docs</a>"
577606
},
607+
{
608+
"trigger": "contractHash\taccount ID of the contract address",
609+
"contents": "contractHash(${1:code_Cell}, ${2:data_Cell})",
610+
"kind": "function",
611+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-common#contracthash\">Tact Docs</a>"
612+
},
578613
{
579614
"trigger": "context\treturns Context Struct",
580615
"contents": "context()",
@@ -587,6 +622,21 @@
587622
"kind": "function",
588623
"details": "<a href=\"https://docs.tact-lang.org/ref/core-common#newaddress\">Tact Docs</a>"
589624
},
625+
{
626+
"trigger": "emptyBasechainAddress\taddr_none or Address with a null hash",
627+
"contents": "emptyBasechainAddress()",
628+
"kind": "function"
629+
},
630+
{
631+
"trigger": "newBasechainAddress\tAddress in the chain ID 0",
632+
"contents": "newBasechainAddress(${1:hash_Int})",
633+
"kind": "function"
634+
},
635+
{
636+
"trigger": "contractBasechainAddress\tAddress in the chain ID 0 from StateInit",
637+
"contents": "contractBasechainAddress(${1:StateInit})",
638+
"kind": "function"
639+
},
590640
{
591641
"trigger": "contractAddress\tAddress in chain 0 from StateInit",
592642
"contents": "contractAddress(${1:StateInit})",
@@ -605,6 +655,24 @@
605655
"kind": "function",
606656
"details": "<a href=\"https://docs.tact-lang.org/ref/core-common#send\">Tact Docs</a>"
607657
},
658+
{
659+
"trigger": "message\tsend a message using MessageParameters Struct",
660+
"contents": "message($0)",
661+
"kind": "function",
662+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-common#message\">Tact Docs</a>"
663+
},
664+
{
665+
"trigger": "deploy\tdeploy a contract using DeployParameters Struct",
666+
"contents": "deploy($0)",
667+
"kind": "function",
668+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-common#deploy\">Tact Docs</a>"
669+
},
670+
{
671+
"trigger": "cashback\tforward excess funds back",
672+
"contents": "cashback($0)",
673+
"kind": "function",
674+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-common#cashback\">Tact Docs</a>"
675+
},
608676
{
609677
"trigger": "emit\tsend a message body Cell to the outer world",
610678
"contents": "emit(${1:body_Cell})",
@@ -676,13 +744,25 @@
676744
"details": "<a href=\"https://docs.tact-lang.org/ref/core-debug#dumpstack\">Tact Docs</a>"
677745
},
678746
{
679-
"trigger": "throw\talias to nativeThrow",
747+
"trigger": "throw\tthrow an exception with exit code Int",
680748
"contents": "throw(${1:code_Int})",
681749
"kind": "function",
682750
"details": "<a href=\"https://docs.tact-lang.org/ref/core-debug#throw\">Tact Docs</a>"
683751
},
684752
{
685-
"trigger": "nativeThrow\tthrow an exception with exit code Int",
753+
"trigger": "throwIf\tthrow exit code under condition",
754+
"contents": "throwIf(${1:code_Int}, ${2:condition_Bool})",
755+
"kind": "function",
756+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-debug#throwif\">Tact Docs</a>"
757+
},
758+
{
759+
"trigger": "throwUnless\tthrow exit code unless condition",
760+
"contents": "throwUnless(${1:code_Int}, ${2:condition_Bool})",
761+
"kind": "function",
762+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-debug#throwunless\">Tact Docs</a>"
763+
},
764+
{
765+
"trigger": "nativeThrow\tdeprecated",
686766
"contents": "nativeThrow(${1:code_Int})",
687767
"kind": "function",
688768
"details": "<a href=\"https://docs.tact-lang.org/ref/core-debug#nativethrow\">Tact Docs</a>"
@@ -769,6 +849,48 @@
769849
"kind": "function",
770850
"details": "<a href=\"https://docs.tact-lang.org/ref/core-math#pow2\">Tact Docs</a>"
771851
},
852+
{
853+
"trigger": "sqrt\tsqrt of an Int",
854+
"contents": "sqrt(${1:Int})",
855+
"kind": "function",
856+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-math#sqrt\">Tact Docs</a>"
857+
},
858+
{
859+
"trigger": "sign\tsign of an Int",
860+
"contents": "sign(${1:Int})",
861+
"kind": "function",
862+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-math#sign\">Tact Docs</a>"
863+
},
864+
{
865+
"trigger": "divc\tx / y",
866+
"contents": "divc(${1:x_Int}, ${2:y_Int})",
867+
"kind": "function",
868+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-math#divc\">Tact Docs</a>"
869+
},
870+
{
871+
"trigger": "muldivc\t(x * y) / z",
872+
"contents": "muldivc(${1:x_Int}, ${2:y_Int}, ${3:z_Int})",
873+
"kind": "function",
874+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-math#muldivc\">Tact Docs</a>"
875+
},
876+
{
877+
"trigger": "mulShiftRight\t(x * y) / 2^z",
878+
"contents": "mulShiftRight(${1:x_Int}, ${2:y_Int}, ${3:z_Int})",
879+
"kind": "function",
880+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-math#mulshiftright\">Tact Docs</a>"
881+
},
882+
{
883+
"trigger": "mulShiftRightRound\t(x * y) / 2^z",
884+
"contents": "mulShiftRightRound(${1:x_Int}, ${2:y_Int}, ${3:z_Int})",
885+
"kind": "function",
886+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-math#mulshiftround\">Tact Docs</a>"
887+
},
888+
{
889+
"trigger": "mulShiftRightCeil\t(x * y) / 2^z",
890+
"contents": "mulShiftRightCeil(${1:x_Int}, ${2:y_Int}, ${3:z_Int})",
891+
"kind": "function",
892+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-math#mulshiftceil\">Tact Docs</a>"
893+
},
772894
{
773895
"trigger": "checkSignature\tEd25519 signature check of hash using pubkey",
774896
"contents": "checkSignature(${1:hash_Int}, ${2:signature_Slice}, ${3:pubkey_Int})",
@@ -895,6 +1017,30 @@
8951017
"kind": "function",
8961018
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced#nativereserve\">Tact Docs</a>"
8971019
},
1020+
{
1021+
"trigger": "setGasLimit\tlimit gas to X nanoToncoin",
1022+
"contents": "setGasLimit($1)",
1023+
"kind": "function",
1024+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced/#setgaslimit\">Tact Docs</a>"
1025+
},
1026+
{
1027+
"trigger": "getSeed\tget seed for RNG",
1028+
"contents": "getSeed()",
1029+
"kind": "function",
1030+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced/#getseed\">Tact Docs</a>"
1031+
},
1032+
{
1033+
"trigger": "setSeed\tset seed for RNG",
1034+
"contents": "setSeed($1)",
1035+
"kind": "function",
1036+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced/#setseed\">Tact Docs</a>"
1037+
},
1038+
{
1039+
"trigger": "myCode\tcurrent contract code",
1040+
"contents": "myCode()",
1041+
"kind": "function",
1042+
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced/#mycode\">Tact Docs</a>"
1043+
},
8981044
{
8991045
"trigger": "gasConsumed\tget gas consumed so far",
9001046
"contents": "gasConsumed()",
@@ -942,6 +1088,6 @@
9421088
"contents": "myStorageDue()",
9431089
"kind": "function",
9441090
"details": "<a href=\"https://docs.tact-lang.org/ref/core-advanced/#mystoragedue\">Tact Docs</a>"
945-
},
1091+
}
9461092
]
9471093
}

package/Tact.tmLanguage

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@
454454
<key>comment</key>
455455
<string>Other constants from the core library</string>
456456
<key>match</key>
457-
<string>(?&lt;!\.)\b(SendRemainingValue|SendRemainingBalance|SendPayGasSeparately|SendIgnoreErrors|SendBounceIfActionFail|SendDestroyIfZero|SendOnlyEstimateFee|ReserveExact|ReserveAllExcept|ReserveAtMost|ReserveAddOriginalBalance|ReserveInvertSign|ReserveBounceIfActionFail)\b</string>
457+
<string>(?&lt;!\.)\b(SendDefaultMode|SendRemainingValue|SendRemainingBalance|SendPayGasSeparately|SendIgnoreErrors|SendBounceIfActionFail|SendDestroyIfZero|SendOnlyEstimateFee|ReserveExact|ReserveAllExcept|ReserveAtMost|ReserveAddOriginalBalance|ReserveInvertSign|ReserveBounceIfActionFail)\b</string>
458458
<key>name</key>
459459
<string>constant.other.builtin.tact</string>
460460
</dict>
@@ -619,7 +619,7 @@
619619
<array>
620620
<dict>
621621
<key>match</key>
622-
<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>
622+
<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>
623623
<key>captures</key>
624624
<dict>
625625
<key>1</key>
@@ -660,7 +660,7 @@
660660
<key>comment</key>
661661
<string>Augmented assignment operators</string>
662662
<key>match</key>
663-
<string>(\+=|-=|\*=|/=|%=|\^=|&amp;=|\|=|&lt;&lt;=|&gt;&gt;=)</string>
663+
<string>(\+=|-=|\*=|/=|%=|\^=|&amp;=|\|=|\|\|=|&amp;&amp;=|&lt;&lt;=|&gt;&gt;=)</string>
664664
<key>name</key>
665665
<string>keyword.operator.assignment.tact</string>
666666
</dict>

package/Tact.tmLanguage.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@
295295
},
296296
{
297297
"comment": "Other constants from the core library",
298-
"match": "(?<!\\.)\\b(SendRemainingValue|SendRemainingBalance|SendPayGasSeparately|SendIgnoreErrors|SendBounceIfActionFail|SendDestroyIfZero|SendOnlyEstimateFee|ReserveExact|ReserveAllExcept|ReserveAtMost|ReserveAddOriginalBalance|ReserveInvertSign|ReserveBounceIfActionFail)\\b",
298+
"match": "(?<!\\.)\\b(SendDefaultMode|SendRemainingValue|SendRemainingBalance|SendPayGasSeparately|SendIgnoreErrors|SendBounceIfActionFail|SendDestroyIfZero|SendOnlyEstimateFee|ReserveExact|ReserveAllExcept|ReserveAtMost|ReserveAddOriginalBalance|ReserveInvertSign|ReserveBounceIfActionFail)\\b",
299299
"name": "constant.other.builtin.tact"
300300
},
301301
{
@@ -404,7 +404,7 @@
404404
"comment": "Serialization",
405405
"patterns": [
406406
{
407-
"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",
407+
"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",
408408
"captures": {
409409
"1": {
410410
"name": "keyword.other.as.tact storage.modifier.tact"
@@ -431,7 +431,7 @@
431431
},
432432
{
433433
"comment": "Augmented assignment operators",
434-
"match": "(\\+=|-=|\\*=|/=|%=|\\^=|&=|\\|=|<<=|>>=)",
434+
"match": "(\\+=|-=|\\*=|/=|%=|\\^=|&=|\\|=|\\|\\|=|&&=|<<=|>>=)",
435435
"name": "keyword.operator.assignment.tact"
436436
},
437437
{

tests/syntax_test_const.tact

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ fun builtin() {
3333
// <- constant.other.caps.tact
3434
// ^^^^^^^^^ constant.other.caps.tact
3535

36+
SendDefaultMode;
37+
// <- constant.other.builtin.tact
3638
SendRemainingValue;
3739
// <- constant.other.builtin.tact
3840
SendRemainingBalance;

tests/syntax_test_primary_expression.tact

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,8 @@ extends fun c(self: Int, ) {
121121
codeOf Contract;
122122
// <- keyword.operator.new.tact
123123
// ^^^^^^^^ entity.name.type.tact
124+
// ^ punctuation.semi.tact
124125

125-
// NOTE: editing constant.character stuff right now
126-
// consider simplifying capture names there :)
127126
// string
128127
"// \\ \" \n\r \t\v \b\f \u{0} \u{FFFFFF} \u0000 \xFF";
129128
// ^ string.quoted.double.tact punctuation.definition.string.begin.tact

tests/syntax_test_struct.tact

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,14 @@ struct Serialization {
9898
// ^^^^^ entity.name.type.tact
9999
payload: Slice as remaining;
100100
// ^^^^^^^^^ entity.name.type.tact
101-
}
101+
102+
v16: Int as varint16;
103+
// ^^^^^^^^ entity.name.type.tact
104+
v32: Int as varint32;
105+
// ^^^^^^^^ entity.name.type.tact
106+
107+
vu16: Int as varuint16;
108+
// ^^^^^^^^^ entity.name.type.tact
109+
vu32: Int as varuint32;
110+
// ^^^^^^^^^ entity.name.type.tact
111+
}

0 commit comments

Comments
 (0)