Skip to content
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

feat: match 1.4.0 #15

Merged
merged 3 commits into from
Jun 21, 2024
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
2 changes: 1 addition & 1 deletion package/Snippets/variable.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<snippet>
<content><![CDATA[let ${1:name}: ${2:type} = ${0:value};]]></content>
<content><![CDATA[let ${1:name}${2:: type} = ${0:value};]]></content>
<tabTrigger>variable</tabTrigger>
<scope>source.tact</scope>
<description>let …: … = …;</description>
Expand Down
6 changes: 3 additions & 3 deletions package/Tact.sublime-completions
Original file line number Diff line number Diff line change
Expand Up @@ -633,10 +633,10 @@
"details": "<a href=\"https://docs.tact-lang.org/ref/core-debug#nativethrow\">Tact Docs</a>"
},
{
"trigger": "nativeThrowWhen\tthrow exit code under condition",
"contents": "nativeThrowWhen(${1:code_Int}, ${2:condition_Bool})",
"trigger": "nativeThrowIf\tthrow exit code under condition",
"contents": "nativeThrowIf(${1:code_Int}, ${2:condition_Bool})",
"kind": "function",
"details": "<a href=\"https://docs.tact-lang.org/ref/core-debug#nativethrowwhen\">Tact Docs</a>"
"details": "<a href=\"https://docs.tact-lang.org/ref/core-debug#nativethrowif\">Tact Docs</a>"
},
{
"trigger": "nativeThrowUnless\tthrow exit code unless condition",
Expand Down
29 changes: 21 additions & 8 deletions package/Tact.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -725,15 +725,15 @@
<key>comment</key>
<string>Control flow keywords, prefixed by more than one dot</string>
<key>match</key>
<string>(?&lt;=\.\.)\b(else|catch|until|in)\b</string>
<string>(?&lt;=\.\.)\b(else|catch|until|in(?!\s*\())\b</string>
<key>name</key>
<string>keyword.control.tact</string>
</dict>
<dict>
<key>comment</key>
<string>Control flow keywords</string>
<key>match</key>
<string>(?&lt;!\.)\b(if|else|try|catch|repeat|do|until|while|foreach|in|return)\b</string>
<string>(?&lt;!\.)\b(if|else|try|catch|repeat|do|until|while|foreach|in(?!\s*\()|return)\b</string>
<key>name</key>
<string>keyword.control.tact</string>
</dict>
Expand Down Expand Up @@ -849,12 +849,25 @@
</dict>
<key>variable</key>
<dict>
<key>comment</key>
<string>Any valid Tact identifier</string>
<key>match</key>
<string>\b([a-zA-Z_][a-zA-Z0-9_]*)\b</string>
<key>name</key>
<string>variable.other.tact</string>
<key>patterns</key>
<array>
<dict>
<key>comment</key>
<string>Any valid Tact identifier</string>
<key>match</key>
<string>(?&lt;!\.)\b(_)\b</string>
<key>name</key>
<string>comment.unused-identifier.tact</string>
</dict>
<dict>
<key>comment</key>
<string>Any valid Tact identifier</string>
<key>match</key>
<string>\b([a-zA-Z_][a-zA-Z0-9_]*)\b</string>
<key>name</key>
<string>variable.other.tact</string>
</dict>
</array>
</dict>
</dict>
</dict>
Expand Down
19 changes: 14 additions & 5 deletions package/Tact.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -475,12 +475,12 @@
},
{
"comment": "Control flow keywords, prefixed by more than one dot",
"match": "(?<=\\.\\.)\\b(else|catch|until|in)\\b",
"match": "(?<=\\.\\.)\\b(else|catch|until|in(?!\\s*\\())\\b",
"name": "keyword.control.tact"
},
{
"comment": "Control flow keywords",
"match": "(?<!\\.)\\b(if|else|try|catch|repeat|do|until|while|foreach|in|return)\\b",
"match": "(?<!\\.)\\b(if|else|try|catch|repeat|do|until|while|foreach|in(?!\\s*\\()|return)\\b",
"name": "keyword.control.tact"
},
{
Expand Down Expand Up @@ -556,9 +556,18 @@
},

"variable": {
"comment": "Any valid Tact identifier",
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b",
"name": "variable.other.tact"
"patterns": [
{
"comment": "Any valid Tact identifier",
"match": "(?<!\\.)\\b(_)\\b",
"name": "comment.unused-identifier.tact"
},
{
"comment": "Any valid Tact identifier",
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b",
"name": "variable.other.tact"
}
]
}
}
}
3 changes: 3 additions & 0 deletions tests/syntax_test_statement.tact
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ extends fun c(self: SomeMessage): Int {
// ^^ keyword.operator.assignment.tact
// ^^ constant.numeric.decimal.tact
// ^ punctuation.semi.tact

let _ = 20;
// ^ comment.unused-identifier.tact
}

self.description = "Tact is awesome!";
Expand Down
Loading