Skip to content

Commit

Permalink
feat: match 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
novusnota committed Jun 12, 2024
1 parent b360d10 commit bc4cfce
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 11 deletions.
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
27 changes: 20 additions & 7 deletions package/Tact.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -849,13 +849,26 @@
</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>
</plist>
</plist>
15 changes: 12 additions & 3 deletions package/Tact.tmLanguage.json
Original file line number Diff line number Diff line change
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

0 comments on commit bc4cfce

Please sign in to comment.