Skip to content

Commit

Permalink
add highlighting for unchecked/receive/try/catch/error
Browse files Browse the repository at this point in the history
  • Loading branch information
tintinweb committed Dec 2, 2021
1 parent 2fd50f0 commit eaba1eb
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"publisher": "tintinweb",
"icon": "images/icon.png",
"preview": true,
"version": "0.0.4",
"version": "0.0.5",
"engines": {
"vscode": "^1.60.0"
},
Expand Down
24 changes: 21 additions & 3 deletions src/syntaxes/solidity.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
{
"include": "#assembly"
},
{
"include": "#uncheckedBlock"
},
{
"include": "#punctuation"
}
Expand Down Expand Up @@ -217,7 +220,7 @@
]
},
"control-flow": {
"match": "\\b(if|else|for|while|do|break|continue|throw|returns?)\\b",
"match": "\\b(if|else|for|while|do|break|try|catch|continue|throw|returns?)\\b",
"name": "keyword.control.flow.solidity"
},
"control-using": {
Expand Down Expand Up @@ -414,6 +417,9 @@
{
"include": "#declaration-function-fallback"
},
{
"include": "#declaration-function-receive"
},
{
"include": "#declaration-function"
},
Expand Down Expand Up @@ -482,7 +488,7 @@
}
},
"declaration-event": {
"match": "\\b(event)(\\s+([A-Za-z_]\\w*))?\\b",
"match": "\\b(error|event)(\\s+([A-Za-z_]\\w*))?\\b",
"captures": {
"1": {
"name": "storage.type.event.solidity"
Expand Down Expand Up @@ -524,9 +530,13 @@
]
},
"declaration-function-fallback": {
"match": "\\b(function)\\s*\\(\\s*\\)",
"match": "\\b(function|fallback)\\s*\\(\\s*\\)",
"name": "storage.type.function.fallback.solidity"
},
"declaration-function-receive": {
"match": "\\b(receive)\\s*\\(\\s*\\)",
"name": "storage.type.function.receive.solidity"
},
"declaration-function": {
"begin": "\\b(function)\\s+([A-Za-z_]\\w*)\\b",
"beginCaptures": {
Expand Down Expand Up @@ -639,6 +649,14 @@
}
]
},
"uncheckedBlock": {
"patterns": [
{
"match": "\\b(unchecked)\\b",
"name": "keyword.control.unchecked.solidity"
}
]
},
"punctuation": {
"patterns": [
{
Expand Down
16 changes: 16 additions & 0 deletions src/themes/dark_sva_default_highlights.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@
"fontStyle":"bold underline"
}
},
{
"name":"unchecked",
"scope":"keyword.control.unchecked.solidity",
"settings":{
"foreground":"#ff5e5ed3",
"fontStyle":"bold underline"
}
},
{
"name":"let",
"scope":"keyword.control.let.solidity",
Expand Down Expand Up @@ -261,6 +269,14 @@
"fontStyle":"underline bold"
}
},
{
"name":"receive",
"scope":"storage.type.function.receive.solidity",
"settings":{
"foreground":"#fae674d7",
"fontStyle":"underline bold"
}
},
{
"name":"enum",
"scope":"entity.name.type.enum.solidity",
Expand Down
16 changes: 16 additions & 0 deletions src/themes/light_sva_default_highlights.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@
"fontStyle":"bold underline"
}
},
{
"name":"unchecked",
"scope":"keyword.control.unchecked.solidity",
"settings":{
"foreground":"#e05959",
"fontStyle":"bold underline"
}
},
{
"name":"let",
"scope":"keyword.control.let.solidity",
Expand Down Expand Up @@ -261,6 +269,14 @@
"fontStyle":"underline bold"
}
},
{
"name":"receive",
"scope":"storage.type.function.receive.solidity",
"settings":{
"foreground":"#268BD2",
"fontStyle":"underline bold"
}
},
{
"name":"enum",
"scope":"entity.name.type.enum.solidity",
Expand Down

0 comments on commit eaba1eb

Please sign in to comment.