From 0835ea737e8d862e13f069dae87b234f6680780b Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Tue, 28 Jan 2025 00:57:13 +0100 Subject: [PATCH] fix: patch 1.5.3 (#30) * fix: patch highlighting of serialization formats and remove of invalid properties * feat: highlight `asm` as a keyword * chore: update links to documentation pages for entities introduced in 1.4.0 and 1.5.0 Tact versions --- package/Tact.sublime-completions | 74 +++++++++++++++++++------------- package/Tact.tmLanguage | 24 ++++++----- package/Tact.tmLanguage.json | 16 ++++--- tests/syntax_test_import.tact | 2 +- tests/syntax_test_struct.tact | 2 +- 5 files changed, 68 insertions(+), 50 deletions(-) diff --git a/package/Tact.sublime-completions b/package/Tact.sublime-completions index 16cc445..4a0f4bc 100644 --- a/package/Tact.sublime-completions +++ b/package/Tact.sublime-completions @@ -17,7 +17,8 @@ { "trigger": "asm\tasm with optional arrangement (...)", "contents": "asm $0", - "kind": ["function", "a", "Attribute"] + "kind": ["function", "a", "Attribute"], + "details": "Tact Docs" }, // Literals, Base trait and constants @@ -108,7 +109,8 @@ { "trigger": "SendOnlyEstimateFee\tequal to 1024", "contents": "SendOnlyEstimateFee", - "kind": ["variable", "c", "Constant"] + "kind": ["variable", "c", "Constant"], + "details": "Tact Docs" }, { "trigger": "ReserveExact\tequal to 0", @@ -163,12 +165,14 @@ { "trigger": "StdAddress", "contents": "StdAddress", - "kind": ["variable", "s", "Struct"] + "kind": ["variable", "s", "Struct"], + "details": "Tact Docs" }, { "trigger": "VarAddress", "contents": "VarAddress", - "kind": ["variable", "s", "Struct"] + "kind": ["variable", "s", "Struct"], + "details": "Tact Docs" }, // Built-in types and serialization options @@ -630,22 +634,26 @@ { "trigger": "slice\tSlice from a BoC String at compile-time", "contents": "slice(${1:bocBase64String})", - "kind": "function" + "kind": "function", + "details": "Tact Docs" }, { "trigger": "rawSlice\tSlice from a String at compile-time", "contents": "rawSlice(${1:someString})", - "kind": "function" + "kind": "function", + "details": "Tact Docs" }, { - "trigger": "ascii\tInt sum of ASCII values at compile-time", + "trigger": "ascii\tInt of hex of ASCII characters at compile-time", "contents": "aslii(${1:asciiString})", - "kind": "function" + "kind": "function", + "details": "Tact Docs" }, { "trigger": "crc32\tCRC32 of a String at compile-time", "contents": "crc32(${1:someString})", - "kind": "function" + "kind": "function", + "details": "Tact Docs" }, // Core library: Debug @@ -694,12 +702,14 @@ { "trigger": "parseStdAddress\tparse StdAddress from a Slice", "contents": "parseStdAddress(${1:slice_Slice})", - "kind": "function" + "kind": "function", + "details": "Tact Docs" }, { "trigger": "parseVarAddress\tparse VarAddress from a Slice", "contents": "parseVarAddress(${1:slice_Slice})", - "kind": "function" + "kind": "function", + "details": "Tact Docs" }, // Core library: Random @@ -868,15 +878,16 @@ "details": "Tact Docs" }, { - "trigger": "nativeSendMessage\tsend message Cell with mode Int", - "contents": "nativeSendMessage(${1:cell}, ${2:mode_Int})", + "trigger": "nativeSendMessage\tsend msg Cell with mode Int", + "contents": "nativeSendMessage(${1:msg_Cell}, ${2:mode_Int})", "kind": "function", "details": "Tact Docs" }, { - "trigger": "nativeSendMessageReturnForwardFee\tsend message Cell with mode Int and get fees", - "contents": "nativeSendMessageReturnForwardFee(${1:cell}, ${2:mode_Int})", - "kind": "function" + "trigger": "nativeSendMessageReturnForwardFee\tsend msg Cell with mode Int and get fees", + "contents": "nativeSendMessageReturnForwardFee(${1:msg_Cell}, ${2:mode_Int})", + "kind": "function", + "details": "Tact Docs" }, { "trigger": "nativeReserve\treserve nanoToncoin amount Int with mode Int", @@ -884,50 +895,53 @@ "kind": "function", "details": "Tact Docs" }, - { - "trigger": "nativeReserve\treserve nanoToncoin amount Int with mode Int", - "contents": "nativeReserve(${1:amount_Int}, ${2:mode_Int})", - "kind": "function" - }, { "trigger": "gasConsumed\tget gas consumed so far", "contents": "gasConsumed()", - "kind": "function" + "kind": "function", + "details": "Tact Docs" }, { "trigger": "getComputeFee\tcalc compute cost in nanoToncoins", "contents": "getComputeFee(${1:gas_used_Int, ${2:is_masterchain_Bool})", - "kind": "function" + "kind": "function", + "details": "Tact Docs" }, { "trigger": "getStorageFee\tcalc storage fees in nanoToncoins", "contents": "getStorageFee(${1:cells_Int, ${2:bits_Int}, ${3:seconds_Int}, ${4:is_masterchain_Bool})", - "kind": "function" + "kind": "function", + "details": "Tact Docs" }, { "trigger": "getForwardFee\tcalc forward fees in nanoToncoins", "contents": "getForwardFee(${1:cells_Int, ${2:bits_Int}, ${3:is_masterchain_Bool})", - "kind": "function" + "kind": "function", + "details": "Tact Docs" }, { "trigger": "getSimpleComputeFee\tcalc extra compute cost in nanoToncoins", "contents": "getSimpleComputeFee(${1:gas_used_Int, ${2:is_masterchain_Bool})", - "kind": "function" + "kind": "function", + "details": "Tact Docs" }, { "trigger": "getSimpleForwardFee\tcalc extra forward fees in nanoToncoins", "contents": "getSimpleForwardFee(${1:cells_Int, ${2:bits_Int}, ${3:is_masterchain_Bool})", - "kind": "function" + "kind": "function", + "details": "Tact Docs" }, { "trigger": "getOriginalFwdFee\tcalc original fwd_fee in nanoToncoins", "contents": "getOriginalFwdFee(${1:fwd_fee_Int, ${2:is_masterchain_Bool})", - "kind": "function" + "kind": "function", + "details": "Tact Docs" }, { "trigger": "myStorageDue\tstorage fee debt in nanoToncoins", - "contents": "myStorageDue(${1:fwd_fee_Int, ${2:is_masterchain_Bool})", - "kind": "function" + "contents": "myStorageDue()", + "kind": "function", + "details": "Tact Docs" }, ] } diff --git a/package/Tact.tmLanguage b/package/Tact.tmLanguage index 6cc1e75..86b055d 100644 --- a/package/Tact.tmLanguage +++ b/package/Tact.tmLanguage @@ -4,18 +4,12 @@ name Tact - displayName - Tact scopeName source.tact fileTypes tact - foldingStartMarker - \{\s*$ - foldingStopMarker - ^\s*\} patterns @@ -128,7 +122,7 @@ todo match - (?i)\b(FIXME|TODO|CHANGED|XXX|IDEA|HACK|NOTE|REVIEW|NB|BUG)\b(?-i) + \b(FIXME|TODO|CHANGED|XXX|IDEA|HACK|NOTE|REVIEW|NB|BUG)\b name keyword.comment.todo.tact @@ -222,7 +216,7 @@ 1 name - entity.other.attribute-name.tact + keyword.other.asm.tact 2 @@ -274,10 +268,18 @@ comment Fallback match match - (?<!\.)\b(@name|@interface|asm)\b + (?<!\.)\b(@name|@interface)\b name entity.other.attribute-name.tact + + comment + Fallback match + match + (?<!\.)\b(asm)\b + name + keyword.other.asm.tact + literal @@ -617,7 +619,7 @@ match - (?<!\.)\b(as)\s+(coins|remaining|bytes32|bytes64|int257|u?int(?:2[0-5][0-6]|1[0-9][0-9]|[1-9][0-9]?))\b + (?<!\.)\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 captures 1 @@ -929,4 +931,4 @@ - + \ No newline at end of file diff --git a/package/Tact.tmLanguage.json b/package/Tact.tmLanguage.json index 1b5d3ee..ebec485 100644 --- a/package/Tact.tmLanguage.json +++ b/package/Tact.tmLanguage.json @@ -1,12 +1,9 @@ { "name": "Tact", - "displayName": "Tact", "scopeName": "source.tact", "fileTypes": [ "tact" ], - "foldingStartMarker": "\\{\\s*$", - "foldingStopMarker": "^\\s*\\}", "patterns": [ { "include": "#comment" @@ -84,7 +81,7 @@ }, "todo": { - "match": "(?i)\\b(FIXME|TODO|CHANGED|XXX|IDEA|HACK|NOTE|REVIEW|NB|BUG)\\b(?-i)", + "match": "\\b(FIXME|TODO|CHANGED|XXX|IDEA|HACK|NOTE|REVIEW|NB|BUG)\\b", "name": "keyword.comment.todo.tact" }, @@ -143,7 +140,7 @@ "begin": "(?