diff --git a/src/Stratis.VS.StratisEVM/Grammars/Solidity.tmLanguage b/src/Stratis.VS.StratisEVM/Grammars/Solidity.tmLanguage deleted file mode 100644 index 8015688..0000000 --- a/src/Stratis.VS.StratisEVM/Grammars/Solidity.tmLanguage +++ /dev/null @@ -1,1531 +0,0 @@ - - - - - fileTypes - - sol - - firstLineMatch - ^#!/.*\b(pragma solidity \^[0..9]+\.[0..9]\.[0..9])$\n? - keyEquivalent - ^~S - name - Solidity - patterns - - - include - #core - - - repository - - brackets - - patterns - - - include - #round-brackets - - - include - #square-brackets - - - include - #curly-brackets - - - - comments - - patterns - - - include - #special-comments-conditional-compilation - - - begin - /\*\*(?!/) - captures - - 0 - - name - punctuation.definition.comment.sol - - - end - \*/ - name - comment.block.documentation.sol - - - begin - /\* - captures - - 0 - - name - punctuation.definition.comment.sol - - - end - \*/ - name - comment.block.sol - - - captures - - 1 - - name - punctuation.definition.comment.sol - - - match - (//).*$\n? - name - comment.line.double-slash.sol - - - - core - - patterns - - - include - #literal-function-labels - - - include - #literal-labels - - - include - #literal-keywords - - - include - #literal-for - - - include - #expression - - - include - #literal-punctuation - - - - curly-brackets - - patterns - - - begin - \{ - beginCaptures - - 0 - - name - meta.brace.curly.sol - - - end - \} - endCaptures - - 0 - - name - meta.brace.curly.sol - - - name - meta.group.braces.curly - patterns - - - include - $self - - - - - - expression - - patterns - - - include - #support - - - include - #literal-function - - - include - #literal-regexp - - - include - #literal-number - - - include - #literal-string - - - include - #literal-language-constant - - - include - #literal-language-variable - - - include - #literal-contract - - - include - #literal-library - - - include - #literal-function-call - - - include - #comments - - - include - #brackets - - - include - #literal-operators - - - include - #literal-variable - - - - function-declaration-parameters - - patterns - - - begin - \( - beginCaptures - - 0 - - name - punctuation.definition.parameters.begin.sol - - - end - \) - endCaptures - - 0 - - name - punctuation.definition.parameters.end.sol - - - patterns - - - match - [_$a-zA-Z][$\w]* - name - variable.parameter.function.sol - - - match - , - name - punctuation.separator.parameter.function.sol - - - include - #comments - - - - - - literal-contract - - patterns - - - begin - (?x) (?<!\.)\b(contract|interface) \s+((?!\b(is)\b)[A-Z][$\w]*)? - beginCaptures - - 1 - - name - storage.type.contract.sol - - 2 - - name - entity.name.contract.sol - - - end - } - endCaptures - - 0 - - name - meta.brace.curly.sol - - - - - - literal-library - - patterns - - - begin - (?x) (?<!\.)\b(library) \s+([A-Z][$\w]*)? - beginCaptures - - 1 - - name - storage.type.library.sol - - 2 - - name - entity.name.library.sol - - - end - } - endCaptures - - 0 - - name - meta.brace.curly.sol - - - - - - literal-for - - patterns - - - begin - (?<!\.)\b(for)\b - beginCaptures - - 1 - - name - keyword.control.loop.sol - - - end - \) - endCaptures - - 0 - - name - meta.brace.round.sol - - - name - meta.for.sol - patterns - - - begin - \( - beginCaptures - - 0 - - name - meta.brace.round.sol - - - end - (?=\)) - patterns - - - include - #literal-keyword-storage - - - include - #expression - - - include - #literal-punctuation - - - - - - - - literal-function - - patterns - - - begin - - (?x) \s*(function)(?:\s*(\*)|(?=\s|[(])) - \s*([_$a-zA-Z][$\w]*)?\s* - - beginCaptures - - 1 - - name - storage.type.sol - - 2 - - name - storage.type.function.sol - - 3 - - name - keyword.generator.asterisk.sol - - 4 - - name - entity.name.function.sol - - - end - (?<=\)) - name - meta.function.sol - patterns - - - include - #function-declaration-parameters - - - - - begin - - (?x) (\b[_$a-zA-Z][$\w]*) \s*= - \s*(function|event|modifier)(?:\s*(\*)|(?=\s|[(])) - \s*([_$a-zA-Z][$\w]*)?\s* - - beginCaptures - - 1 - - name - entity.name.function.sol - - 2 - - name - storage.type.sol - - 3 - - name - storage.type.function.sol - - 4 - - name - keyword.generator.asterisk.sol - - 5 - - name - entity.name.function.sol - - - end - (?<=\)) - name - meta.function.sol - patterns - - - include - #function-declaration-parameters - - - - - begin - - (?x) (\b_?[A-Z][$\w]*)? - (\.)([_$a-zA-Z][$\w]*) \s*= - \s*(function)(?:\s*(\*)|(?=\s|[(])) - \s*([_$a-zA-Z][$\w]*)?\s* - - beginCaptures - - 1 - - name - keyword.operator.accessor.sol - - 2 - - name - variable.language.prototype.sol - - 3 - - name - keyword.operator.accessor.sol - - 4 - - name - entity.name.function.sol - - 5 - - name - storage.type.sol - - 6 - - name - storage.type.function.sol - - 7 - - name - keyword.generator.asterisk.sol - - 8 - - name - entity.name.function.sol - - - end - (?<=\)) - name - meta.prototype.function.sol - patterns - - - include - #function-declaration-parameters - - - - - begin - - (?x) (\b_?[A-Z][$\w]*)? (\.)([_$a-zA-Z][$\w]*) \s*= - \s*(function|event|modifier)(?:\s*(\*)|(?=\s|[(])) - \s*([_$a-zA-Z][$\w]*)*\s* - - beginCaptures - - 1 - - name - keyword.operator.accessor.sol - - 2 - - name - entity.name.function.sol - - 3 - - name - storage.type.sol - - 4 - - name - storage.type.function.sol - - 5 - - name - keyword.generator.asterisk.sol - - 6 - - name - entity.name.function.sol - - - end - (?<=\)) - name - meta.function.static.sol - patterns - - - include - #function-declaration-parameters - - - - - - literal-function-call - - patterns - - - captures - - 1 - - name - entity.name.function.sol - - 2 - - name - meta.group.braces.round.function.arguments.sol - - - match - (?x) ([_$a-zA-Z][$\w]*)\s* (\(\s*\)) - name - meta.function-call.without-arguments.sol - - - captures - - 1 - - name - entity.name.function.sol - - - match - (?x) ([_$a-zA-Z][$\w]*)\s* (?=\() - name - meta.function-call.with-arguments.sol - - - - literal-function-labels - - patterns - - - begin - - (?x) \b([_$a-zA-Z][$\w]*) \s*(:) - \s*(function|event|modifier)(?:\s*(\*)|(?=\s|[(])) - \s*([_$a-zA-Z][$\w]*)*\s* - - beginCaptures - - 1 - - name - entity.name.function.sol - - 2 - - name - punctuation.separator.key-value.sol - - 3 - - name - storage.type.sol - - 4 - - name - storage.type.function.sol - - 5 - - name - keyword.generator.asterisk.sol - - 6 - - name - entity.name.function.sol - - - end - (?<=\)) - patterns - - - include - #function-declaration-parameters - - - - - begin - - (?x) (?: - ((')((?:[^']|\\')*)('))| - ((")((?:[^"]|\\")*)(")) ) \s*(:) - \s*(function|event|modifier)(?:\s*(\*)|(?=\s|[(])) - \s*([_$a-zA-Z][$\w]*)*\s* - - beginCaptures - - 1 - - name - string.quoted.single.sol - - 10 - - name - storage.type.sol - - 11 - - name - storage.type.function.sol - - 12 - - name - keyword.generator.asterisk.sol - - 13 - - name - entity.name.function.sol - - 2 - - name - punctuation.definition.string.begin.sol - - 3 - - name - entity.name.function.sol - - 4 - - name - punctuation.definition.string.end.sol - - 5 - - name - string.quoted.double.sol - - 6 - - name - punctuation.definition.string.begin.sol - - 7 - - name - entity.name.function.sol - - 8 - - name - punctuation.definition.string.end.sol - - 9 - - name - punctuation.separator.key-value.sol - - - end - (?<=\)) - patterns - - - include - #function-declaration-parameters - - - - - - literal-keyword-storage - - patterns - - - match - (?<!\.)\b(constant)\b - name - storage.type.sol - - - - literal-keywords - - patterns - - - include - #literal-keyword-storage - - - match - (?<!\.)\b(return)\b - name - keyword.control.flow.sol - - - match - (?<!\.)\b(if|else)\b - name - keyword.control.conditional.sol - - - match - (?<!\.)\b(require|assert)\b - name - keyword.require-assert.sol - - - - literal-labels - - patterns - - - begin - - (?x) (?<!\?)(?<!\?\s)(?=( - ((')((?:[^']|\\')*)('))| - ((")((?:[^"]|\\")*)(")) )\s*:) - - end - : - endCaptures - - 0 - - name - punctuation.separator.key-value.sol - - - patterns - - - include - #literal-string - - - - - captures - - 1 - - name - string.unquoted.label.sol - - 2 - - name - punctuation.separator.key-value.sol - - - match - (?<!\.|\?|\?\s)([_$a-zA-Z][$\w]*)\s*(:) - name - constant.other.object.key.sol - - - - literal-language-constant - - patterns - - - match - (?<!\.)\btrue\b - name - constant.language.boolean.true.sol - - - match - (?<!\.)\bfalse\b - name - constant.language.boolean.false.sol - - - - literal-language-variable - - patterns - - - match - (?<!(?<!\.\.)\.)\b(arguments)\b - name - variable.language.arguments.sol - - - match - (?<!(?<!\.\.)\.)\b(super)\b - name - variable.language.super.sol - - - match - (?<!(?<!\.\.)\.)\b(this)\b - name - variable.language.this.sol - - - - literal-number - - patterns - - - match - (?i)(?:\B[-+]|\b)0x[0-9a-f]*\.(\B|\b[0-9]+) - name - invalid.illegal.numeric.hex.sol - - - match - (?:\B[-+]|\b)0[0-9]+\.(\B|\b[0-9]+) - name - invalid.illegal.numeric.octal.sol - - - match - - (?xi) (?:\B[-+])? (?: \b0b[0-1]*| # binary - \b0o[0-7]*| # octal \b0x[0-9a-f]*| # hex ( - \B\.[0-9]+| # e.g. .999 \b[0-9]+(\.[0-9]*)? # e.g. - 999.999, 999. or 999 )(e[-+]?[0-9]+)? # e.g. e+123, - E-123 ) - - name - constant.numeric.sol - - - - literal-operators - - patterns - - - match - (?<!\.)\b(delete|new)\b - name - keyword.operator.sol - - - match - - (?x) !(?!=)| # logical-not right-to-left right - && | # logical-and left-to-right both \|\| | - # logical-or left-to-right both - - name - keyword.operator.logical.sol - - - match - (?x) =(?!=)| # assignment right-to-left both - name - keyword.operator.assignment.sol - - - match - - (?x) %= | # assignment right-to-left both &= | # - assignment right-to-left both \*= | # assignment - right-to-left both \+= | # assignment right-to-left - both -= | # assignment right-to-left both /= | # - assignment right-to-left both \^= | # assignment - right-to-left both \|= | # assignment right-to-left - both <<= | # assignment right-to-left both - >>= | # assignment right-to-left both - >>>= | # assignment right-to-left both - - name - keyword.operator.assignment.augmented.sol - - - match - - (?x) ~ | # bitwise-not right-to-left right << - | # bitwise-shift left-to-right both >>> | - # bitwise-shift left-to-right both >> | # - bitwise-shift left-to-right both & | # - bitwise-and left-to-right both \^ | # bitwise-xor - left-to-right both \| # bitwise-or left-to-right - both - - name - keyword.operator.bitwise.sol - - - match - - (?x) <= | # relational left-to-right both >= | - # relational left-to-right both < | # relational - left-to-right both > # relational left-to-right - both - - name - keyword.operator.relational.sol - - - match - - (?x) == | # equality left-to-right both != # equality left-to-right both - - name - keyword.operator.comparison.sol - - - match - - (?x) / | # division left-to-right both - % | # modulus left-to-right both - \* | # multiplication left-to-right both - \+ | # addition left-to-right both - - # subtraction left-to-right both - - name - keyword.operator.arithmetic.sol - - - match - \?|: - name - keyword.operator.ternary.sol - - - match - (?<!\.)\.\.\. - name - keyword.operator.spread.sol - - - match - \. - name - keyword.operator.accessor.sol - - - - literal-prototype - - patterns - - - captures - - 1 - - name - entity.name.class.sol - - 2 - - name - keyword.operator.accessor.sol - - 3 - - name - variable.language.prototype.sol - - - match - ([_$a-zA-Z][$\w]*)(\.)(prototype)\b - name - meta.prototype.access.sol - - - captures - - 1 - - name - entity.name.class.sol - - 2 - - name - keyword.operator.accessor.sol - - 3 - - name - variable.language.prototype.sol - - - match - ([_$a-zA-Z][$\w]*)(\.)(prototype)\s*=\s* - name - meta.prototype.declaration.sol - - - - literal-punctuation - - patterns - - - match - \; - name - punctuation.terminator.statement.sol - - - match - , - name - meta.delimiter.comma.sol - - - - literal-regexp - - patterns - - - begin - - (?x) (?<= - \.|\(|,|{|}|\[|;|,|<|>|<=|>=|==|!=|\+|-|\*|%|\+\+|--|<<|>>|>>>|&|\||\^|!|~|&&|\|\||\?|:|=|\+=|-=|\*=|%=|<<=|>>=|>>>=|&=|\|=|\^=|/|/=| \Wnew|\Wdelete|\Wvoid|\Wreturn| ^new|^delete|^void|^return|^ )\s* (/) (?!/|\*|$) - - beginCaptures - - 1 - - name - punctuation.definition.string.begin.sol - - - end - (/)([gimy]*) - endCaptures - - 1 - - name - punctuation.definition.string.end.sol - - 2 - - name - keyword.other.sol - - - name - string.regexp.sol - patterns - - - include - source.regexp.sol - - - - - - literal-string - - patterns - - - begin - ' - beginCaptures - - 0 - - name - punctuation.definition.string.begin.sol - - - end - (')|(\n) - endCaptures - - 1 - - name - punctuation.definition.string.end.sol - - 2 - - name - invalid.illegal.newline.sol - - - name - string.quoted.single.sol - patterns - - - include - #string-content - - - - - begin - " - beginCaptures - - 0 - - name - punctuation.definition.string.begin.sol - - - end - (")|(\n) - endCaptures - - 1 - - name - punctuation.definition.string.end.sol - - 2 - - name - invalid.illegal.newline.sol - - - name - string.quoted.double.sol - patterns - - - include - #string-content - - - - - - literal-variable - - patterns - - - match - [A-Z][_$\dA-Z]*\b - name - variable.other.constant.sol - - - captures - - 1 - - name - punctuation.dollar.sol - - - match - (\$)[$\w]+ - name - variable.other.dollar.sol - - - captures - - 1 - - name - variable.other.class.sol - - 2 - - name - keyword.operator.accessor.sol - - 3 - - name - variable.other.property.static.sol - - - match - (?x) \b([A-Z][$\w]*)\s*(\.) ([_$a-zA-Z][$\w]*) - name - meta.property.class.sol - - - captures - - 1 - - name - variable.other.object.sol - - - match - (?<!\.)[_$a-zA-Z][$\w]*\s*(?=[\[\.]) - name - variable.other.object.sol - - - captures - - 2 - - name - variable.other.property.sol - - - match - (?<=\.)\s*[_$a-zA-Z][$\w]* - name - meta.property.object.sol - - - match - [_$a-zA-Z][$\w]* - name - variable.other.readwrite.sol - - - - round-brackets - - patterns - - - begin - \( - beginCaptures - - 0 - - name - meta.brace.round.sol - - - end - \) - endCaptures - - 0 - - name - meta.brace.round.sol - - - name - meta.group.braces.round - patterns - - - include - #expression - - - - - - special-comments-conditional-compilation - - patterns - - - begin - /\*(?=@) - captures - - 0 - - name - punctuation.definition.comment.sol - - - end - \*/ - endCaptures - - 1 - - name - keyword.control.conditional.sol - - 2 - - name - punctuation.definition.keyword.sol - - - name - comment.block.conditional.sol - patterns - - - match - /\* - name - punctuation.definition.comment.sol - - - include - $self - - - - - captures - - 1 - - name - punctuation.definition.keyword.sol - - - match - (@)(if|elif|else|end|ifdef|endif|cc_on|set)\b - name - keyword.control.conditional.sol - - - captures - - 1 - - name - punctuation.definition.variable.sol - - - - - - square-brackets - - patterns - - - begin - \[ - beginCaptures - - 0 - - name - meta.brace.square.sol - - - end - \] - endCaptures - - 0 - - name - meta.brace.square.sol - - - name - meta.group.braces.square - patterns - - - include - #expression - - - - - - string-content - - patterns - - - match - \\\s*\n - name - constant.character.escape.newline.sol - - - match - \\(x[\da-fA-F]{2}|u[\da-fA-F]{4}|.) - name - constant.character.escape.sol - - - - support - - patterns - - - match - \.(pop|push)\b - name - support.function.mutator.sol - - - begin - {{ - end - }} - name - meta.tag.mustache.sol - - - - - scopeName - source.sol - uuid - 3F50A19F-DEE2-4C44-8F60-C01CEE8CEA68 - - diff --git a/src/Stratis.VS.StratisEVM/Grammars/solidity.json b/src/Stratis.VS.StratisEVM/Grammars/solidity.json new file mode 100644 index 0000000..da3e47b --- /dev/null +++ b/src/Stratis.VS.StratisEVM/Grammars/solidity.json @@ -0,0 +1,1215 @@ +{ + "fileTypes": [ + "sol" + ], + "name": "Solidity", + "patterns": [ + { + "include": "#natspec" + }, + { + "include": "#declaration-userType" + }, + { + "include": "#comment" + }, + { + "include": "#operator" + }, + { + "include": "#global" + }, + { + "include": "#control" + }, + { + "include": "#constant" + }, + { + "include": "#primitive" + }, + { + "include": "#type-primitive" + }, + { + "include": "#type-modifier-extended-scope" + }, + { + "include": "#declaration" + }, + { + "include": "#function-call" + }, + { + "include": "#assembly" + }, + { + "include": "#punctuation" + } + ], + "repository": { + "natspec": { + "patterns": [ + { + "begin": "/\\*\\*", + "end": "\\*/", + "name": "comment.block.documentation", + "patterns": [ + { + "include": "#natspec-tags" + } + ] + }, + { + "begin": "///", + "end": "$", + "name": "comment.block.documentation", + "patterns": [ + { + "include": "#natspec-tags" + } + ] + } + ] + }, + "natspec-tags": { + "patterns": [ + { + "include": "#comment-todo" + }, + { + "include": "#natspec-tag-title" + }, + { + "include": "#natspec-tag-author" + }, + { + "include": "#natspec-tag-notice" + }, + { + "include": "#natspec-tag-dev" + }, + { + "include": "#natspec-tag-param" + }, + { + "include": "#natspec-tag-return" + }, + { + "include": "#natspec-tag-custom" + }, + { + "include": "#natspec-tag-inheritdoc" + } + ] + }, + "natspec-tag-title": { + "match": "(@title)\\b", + "name": "storage.type.title.natspec" + }, + + "natspec-tag-author": { + "match": "(@author)\\b", + "name": "storage.type.author.natspec" + }, + "natspec-tag-notice": { + "match": "(@notice)\\b", + "name": "storage.type.dev.natspec" + }, + "natspec-tag-custom": { + "match": "(@custom:\\w*)\\b", + "name": "storage.type.dev.natspec" + }, + "natspec-tag-inheritdoc": { + "match": "(@inheritdoc)\\b", + "name": "storage.type.author.natspec" + }, + "natspec-tag-dev": { + "match": "(@dev)\\b", + "name": "storage.type.dev.natspec" + }, + "natspec-tag-param": { + "match": "(@param)(\\s+([A-Za-z_]\\w*))?\\b", + "captures": { + "1": { + "name": "storage.type.param.natspec" + }, + "3": { + "name": "variable.other.natspec" + } + } + }, + "natspec-tag-return": { + "match": "(@return)(\\s+([A-Za-z_]\\w*))?\\b", + "captures": { + "1": { + "name": "storage.type.return.natspec" + }, + "3": { + "name": "variable.other.natspec" + } + } + }, + "comment": { + "patterns": [ + { + "include": "#comment-line" + }, + { + "include": "#comment-block" + } + ] + }, + "comment-todo": { + "match": "(?i)\\b(FIXME|TODO|CHANGED|XXX|IDEA|HACK|NOTE|REVIEW|NB|BUG|QUESTION|COMBAK|TEMP|SUPPRESS|LINT|\\w+-disable|\\w+-suppress)\\b(?-i)", + "name": "keyword.comment.todo" + }, + "comment-line": { + "begin": "(?(?!>)|>=|\\&\\&|\\|\\||\\:(?!=)|\\?|\\!)", + "name": "keyword.operator.logic" + }, + "operator-mapping": { + "match": "(=>)", + "name": "keyword.operator.mapping" + }, + "operator-arithmetic": { + "match": "(\\+|\\-|\\/|\\*)", + "name": "keyword.operator.arithmetic" + }, + "operator-binary": { + "match": "(\\^|\\&|\\||<<|>>)", + "name": "keyword.operator.binary" + }, + "operator-assignment": { + "match": "(\\:?=)", + "name": "keyword.operator.assignment" + }, + "control": { + "patterns": [ + { + "include": "#control-flow" + }, + { + "include": "#control-using" + }, + { + "include": "#control-import" + }, + { + "include": "#control-pragma" + }, + { + "include": "#control-underscore" + }, + { + "include": "#control-unchecked" + }, + { + "include": "#control-other" + } + ] + }, + "control-flow": { + "patterns": [ + { + "match": "\\b(if|else|for|while|do|break|continue|try|catch|finally|throw|return|global)\\b", + "name": "keyword.control.flow" + }, + { + "begin": "\\b(returns)\\b", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.return" + } + }, + "end": "(?=\\))", + "patterns": [ + { + "include": "#declaration-function-parameters" + } + ] + } + ] + }, + "control-using": { + "patterns": [ + { + "match": "\\b(using)\\b\\s+\\b([A-Za-z\\d_]+)\\b\\s+\\b(for)\\b\\s+\\b([A-Za-z\\d_]+)", + "captures": { + "1": { + "name": "keyword.control.using" + }, + "2": { + "name": "entity.name.type.library" + }, + "3": { + "name": "keyword.control.for" + }, + "4": { + "name": "entity.name.type" + } + } + }, + { + "match": "\\b(using)\\b", + "name": "keyword.control.using" + } + ] + }, + "control-import": { + "patterns": [ + { + "begin": "\\b(import)\\b", + "beginCaptures": { + "1": { + "name": "keyword.control.import" + } + }, + "end": "(?=\\;)", + "patterns": [ + { + "begin": "((?=\\{))", + "end": "((?=\\}))", + "patterns": [ + { + "match": "\\b(\\w+)\\b", + "name": "entity.name.type.interface" + } + ] + }, + { + "match": "\\b(from)\\b", + "name": "keyword.control.import.from" + }, + { + "include": "#string" + }, + { + "include": "#punctuation" + } + ] + }, + { + "match": "\\b(import)\\b", + "name": "keyword.control.import" + } + ] + }, + "control-unchecked": { + "match": "\\b(unchecked)\\b", + "name": "keyword.control.unchecked" + }, + "control-pragma": { + "match": "\\b(pragma)(?:\\s+([A-Za-z_]\\w+)\\s+([^\\s]+))?\\b", + "captures": { + "1": { + "name": "keyword.control.pragma" + }, + "2": { + "name": "entity.name.tag.pragma" + }, + "3": { + "name": "constant.other.pragma" + } + } + }, + "control-underscore": { + "match": "\\b(_)\\b", + "name": "constant.other.underscore" + }, + "control-other": { + "match": "\\b(new|delete|emit)\\b", + "name": "keyword.control" + }, + "constant": { + "patterns": [ + { + "include": "#constant-boolean" + }, + { + "include": "#constant-time" + }, + { + "include": "#constant-currency" + } + ] + }, + "constant-boolean": { + "match": "\\b(true|false)\\b", + "name": "constant.language.boolean" + }, + "constant-time": { + "match": "\\b(seconds|minutes|hours|days|weeks|years)\\b", + "name": "constant.language.time" + }, + "constant-currency": { + "match": "\\b(ether|wei|gwei|finney|szabo)\\b", + "name": "constant.language.currency" + }, + "number": { + "patterns": [ + { + "include": "#number-decimal" + }, + { + "include": "#number-hex" + }, + { + "include": "#number-scientific" + } + ] + }, + "number-decimal": { + "match": "\\b([0-9_]+(\\.[0-9_]+)?)\\b", + "name": "constant.numeric.decimal" + }, + "number-hex": { + "match": "\\b(0[xX][a-fA-F0-9]+)\\b", + "name": "constant.numeric.hexadecimal" + }, + "number-scientific": { + "match": "\\b(?:0\\.(?:0[0-9]|[0-9][0-9_]?)|[0-9][0-9_]*(?:\\.\\d{1,2})?)(?:e[+-]?[0-9_]+)?", + "name": "constant.numeric.scientific" + }, + "string": { + "patterns": [ + { + "match": "\\\"(?:\\\\\"|[^\\\"])*\\\"", + "name": "string.quoted.double" + }, + { + "match": "\\'(?:\\\\'|[^\\'])*\\'", + "name": "string.quoted.single" + } + ] + }, + "primitive": { + "patterns": [ + { + "include": "#number-decimal" + }, + { + "include": "#number-hex" + }, + { + "include": "#number-scientific" + }, + { + "include": "#string" + } + ] + }, + "type-primitive": { + "patterns": [ + { + "begin": "\\b(address|string\\d*|bytes\\d*|int\\d*|uint\\d*|bool|hash\\d*)\\b(?:\\[\\])(\\()", + "beginCaptures": { + "1": { + "name": "support.type.primitive" + } + }, + "end": "(\\))", + "patterns": [ + { + "include": "#primitive" + }, + { + "include": "#punctuation" + }, + { + "include": "#global" + }, + { + "include": "#variable" + } + ] + }, + { + "match": "\\b(address|string\\d*|bytes\\d*|int\\d*|uint\\d*|bool|hash\\d*)\\b", + "name": "support.type.primitive" + } + ] + }, + "global": { + "patterns": [ + { + "include": "#global-variables" + }, + { + "include": "#global-functions" + } + ] + }, + "global-variables": { + "patterns": [ + { + "match": "\\b(this)\\b", + "name": "variable.language.this" + }, + { + "match": "\\b(super)\\b", + "name": "variable.language.super" + }, + { + "match": "\\b(abi)\\b", + "name": "variable.language.builtin.abi" + }, + { + "match": "\\b(msg\\.sender|msg|block|tx|now)\\b", + "name": "variable.language.transaction" + }, + { + "match": "\\b(tx\\.origin|tx\\.gasprice|msg\\.data|msg\\.sig|msg\\.value)\\b", + "name": "variable.language.transaction" + } + ] + }, + "global-functions": { + "patterns": [ + { + "match": "\\b(require|assert|revert)\\b", + "name": "keyword.control.exceptions" + }, + { + "match": "\\b(selfdestruct|suicide)\\b", + "name": "keyword.control.contract" + }, + { + "match": "\\b(addmod|mulmod|keccak256|sha256|sha3|ripemd160|ecrecover)\\b", + "name": "support.function.math" + }, + { + "match": "\\b(unicode)\\b", + "name": "support.function.string" + }, + { + "match": "\\b(blockhash|gasleft)\\b", + "name": "variable.language.transaction" + }, + { + "match": "\\b(type)\\b", + "name": "variable.language.type" + } + ] + }, + "type-modifier-access": { + "match": "\\b(internal|external|private|public)\\b", + "name": "storage.type.modifier.access" + }, + "type-modifier-payable": { + "match": "\\b(nonpayable|payable)\\b", + "name": "storage.type.modifier.payable" + }, + "type-modifier-constant": { + "match": "\\b(constant)\\b", + "name": "storage.type.modifier.readonly" + }, + "type-modifier-immutable": { + "match": "\\b(immutable)\\b", + "name": "storage.type.modifier.readonly" + }, + "type-modifier-extended-scope": { + "match": "\\b(pure|view|inherited|indexed|storage|memory|virtual|calldata|override|abstract)\\b", + "name": "storage.type.modifier.extendedscope" + }, + "variable": { + "patterns": [ + { + "match": "\\b(\\_\\w+)\\b", + "captures": { + "1": { + "name": "variable.parameter.function" + } + } + }, + { + "match": "(?:\\.)(\\w+)\\b", + "captures": { + "1": { + "name": "support.variable.property" + } + } + }, + { + "match": "\\b(\\w+)\\b", + "captures": { + "1": { + "name": "variable.parameter.other" + } + } + } + ] + }, + "modifier-call": { + "patterns": [ + { + "include": "#function-call" + }, + { + "match": "\\b(\\w+)\\b", + "name": "entity.name.function.modifier" + } + ] + }, + "declaration": { + "patterns": [ + { + "include": "#declaration-contract" + }, + { + "include": "#declaration-userType" + }, + { + "include": "#declaration-interface" + }, + { + "include": "#declaration-library" + }, + { + "include": "#declaration-function" + }, + { + "include": "#declaration-modifier" + }, + { + "include": "#declaration-constructor" + }, + { + "include": "#declaration-event" + }, + { + "include": "#declaration-storage" + }, + { + "include": "#declaration-error" + } + + ] + }, + "declaration-storage-field": { + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#control" + }, + { + "include": "#type-primitive" + }, + { + "include": "#type-modifier-access" + }, + { + "include": "#type-modifier-immutable" + }, + { + "include": "#type-modifier-extend-scope" + }, + { + "include": "#type-modifier-payable" + }, + { + "include": "#type-modifier-constant" + }, + { + "include": "#primitive" + }, + { + "include": "#constant" + }, + { + "include": "#operator" + }, + { + "include": "#punctuation" + } + ] + }, + "declaration-storage": { + "patterns": [ + { + "include": "#declaration-storage-mapping" + }, + { + "include": "#declaration-struct" + }, + { + "include": "#declaration-enum" + }, + { + "include": "#declaration-storage-field" + } + ] + }, + "declaration-userType": { + "match": "\\b(type)\\b\\s+(\\w+)\\b\\s+\\b(is)\\b", + "captures": { + "1": { + "name": "storage.type.userType" + }, + "2": { + "name": "entity.name.type.userType" + }, + "3": { + "name": "storage.modifier.is" + } + } + }, + "declaration-contract": { + "patterns": [ + { + "begin": "\\b(contract)\\b\\s+(\\w+)\\b\\s+\\b(is)\\b\\s+", + "end": "(?=\\{)", + "beginCaptures": { + "1": { + "name": "storage.type.contract" + }, + "2": { + "name": "entity.name.type.contract" + }, + "3": { + "name": "storage.modifier.is" + } + }, + "patterns": [ + { + "match": "\\b(\\w+)\\b", + "name": "entity.name.type.contract.extend" + } + ] + }, + { + "match": "\\b(contract)(\\s+([A-Za-z_]\\w*))?\\b", + "captures": { + "1": { + "name": "storage.type.contract" + }, + "2": { + "name": "entity.name.type.contract" + } + } + } + + ] + }, + "declaration-interface": { + "patterns": [ + { + "begin": "\\b(interface)\\b\\s+(\\w+)\\b\\s+\\b(is)\\b\\s+", + "end": "(?=\\{)", + "beginCaptures": { + "1": { + "name": "storage.type.interface" + }, + "2": { + "name": "entity.name.type.interface" + }, + "3": { + "name": "storage.modifier.is" + } + }, + "patterns": [ + { + "match": "\\b(\\w+)\\b", + "name": "entity.name.type.interface.extend" + } + ] + }, + { + "match": "\\b(interface)(\\s+([A-Za-z_]\\w*))?\\b", + "captures": { + "1": { + "name": "storage.type.interface" + }, + "2": { + "name": "entity.name.type.interface" + } + } + } + + ] + }, + "declaration-library": { + "match": "\\b(library)(\\s+([A-Za-z_]\\w*))?\\b", + "captures": { + "1": { + "name": "storage.type.library" + }, + "3": { + "name": "entity.name.type.library" + } + } + }, + "declaration-struct": { + "patterns": [ + { + "match": "\\b(struct)(\\s+([A-Za-z_]\\w*))?\\b", + "captures": { + "1": { + "name": "storage.type.struct" + }, + "3": { + "name": "entity.name.type.struct" + } + } + }, + { + "begin": "\\b(struct)\\b\\s*(\\w+)?\\b\\s*(?=\\{)", + "beginCaptures": { + "1": { + "name": "storage.type.struct" + }, + "2": { + "name": "entity.name.type.struct" + } + }, + "end": "(?=\\})", + "patterns": [ + { + "include": "#type-primitive" + }, + { + "include": "#variable" + }, + { + "include": "#punctuation" + }, + { + "include": "#comment" + } + ] + } + ] + }, + "declaration-event": { + "patterns": [ + { + "begin": "\\b(event)\\b(?:\\s+(\\w+)\\b)?", + "end": "(?=\\))", + "beginCaptures": { + "1": { + "name": "storage.type.event" + }, + "2": { + "name": "entity.name.type.event" + } + }, + "patterns": [ + { + "include": "#type-primitive" + }, + { + "match": "\\b(?:(indexed)\\s)?(\\w+)(?:,\\s*|)", + "captures": { + "1": { + "name": "storage.type.modifier.indexed" + }, + "2": { + "name": "variable.parameter.event" + } + } + }, + { + "include": "#punctuation" + } + ] + }, + { + "match": "\\b(event)(\\s+([A-Za-z_]\\w*))?\\b", + "captures": { + "1": { + "name": "storage.type.event" + }, + "3": { + "name": "entity.name.type.event" + } + } + } + ] + }, + "declaration-constructor": { + "patterns": [ + { + "begin": "\\b(constructor)\\b", + "beginCaptures": { + "1": { + "name": "storage.type.constructor" + } + }, + "end": "(?=\\{)", + "patterns": [ + { + "begin": "\\G\\s*(?=\\()", + "end": "(?=\\))", + "patterns": [ + { + "include": "#declaration-function-parameters" + } + ] + }, + { + "begin": "(?<=\\))", + "end": "(?=\\{)", + "patterns": [ + { + "include": "#type-modifier-access" + }, + { + "include": "#function-call" + } + ] + } + ] + }, + { + "match": "\\b(constructor)\\b", + "captures": { + "1": { + "name": "storage.type.constructor" + } + } + } + ] + }, + "declaration-enum": { + "patterns": [ + { + "begin": "\\b(enum)\\s+(\\w+)\\b", + "beginCaptures": { + "1": { + "name": "storage.type.enum" + }, + "2": { + "name": "entity.name.type.enum" + } + }, + "end": "(?=\\})", + "patterns": [ + { + "match": "\\b(\\w+)\\b", + "name": "variable.other.enummember" + }, + { + "include": "#punctuation" + }, + { + "include": "#comment" + } + ] + }, + { + "match": "\\b(enum)(\\s+([A-Za-z_]\\w*))?\\b", + "captures": { + "1": { + "name": "storage.type.enum" + }, + "3": { + "name": "entity.name.type.enum" + } + } + } + ] + }, + "declaration-function-parameters": { + "begin": "\\G\\s*(?=\\()", + "end": "(?=\\))", + "patterns": [ + { + "include": "#type-primitive" + }, + { + "include": "#type-modifier-extended-scope" + }, + { + "match": "\\b([A-Z]\\w*)\\b", + "captures": { + "1": { + "name": "storage.type.struct" + } + } + }, + { + "include": "#variable" + }, + { + "include": "#punctuation" + }, + { + "include": "#comment" + } + ] + }, + "declaration-function": { + "patterns": [ + { + "begin": "\\b(function)\\s+(\\w+)\\b", + "beginCaptures": { + "1": { + "name": "storage.type.function" + }, + "2": { + "name": "entity.name.function" + } + }, + "end": "(?=\\{|;)", + "patterns": [ + { + "include": "#natspec" + }, + { + "include": "#global" + }, + { + "include": "#declaration-function-parameters" + }, + { + "include": "#type-modifier-access" + }, + { + "include": "#type-modifier-payable" + }, + { + "include": "#type-modifier-immutable" + }, + { + "include": "#type-modifier-extended-scope" + }, + { + "include": "#control-flow" + }, + { + "include": "#function-call" + }, + { + "include": "#modifier-call" + }, + { + "include": "#punctuation" + } + ] + }, + { + "match": "\\b(function)\\s+([A-Za-z_]\\w*)\\b", + "captures": { + "1": { + "name": "storage.type.function" + }, + "2": { + "name": "entity.name.function" + } + } + } + ] + }, + "declaration-modifier": { + "patterns": [ + { + "begin": "\\b(modifier)\\b\\s*(\\w+)", + "beginCaptures": { + "1": { + "name": "storage.type.function.modifier" + }, + "2": { + "name": "entity.name.function.modifier" + } + }, + "end": "(?=\\{)", + "patterns": [ + { + "include": "#declaration-function-parameters" + }, + { + "begin": "(?<=\\))", + "end": "(?=\\{)", + "patterns": [ + { + "include": "#declaration-function-parameters" + }, + { + "include": "#type-modifier-access" + }, + { + "include": "#type-modifier-payable" + }, + { + "include": "#type-modifier-immutable" + }, + { + "include": "#type-modifier-extended-scope" + }, + { + "include": "#function-call" + }, + { + "include": "#modifier-call" + }, + { + "include": "#control-flow" + } + ] + } + ] + }, + { + "match": "\\b(modifier)(\\s+([A-Za-z_]\\w*))?\\b", + "captures": { + "1": { + "name": "storage.type.modifier" + }, + "3": { + "name": "entity.name.function" + } + } + } + ] + }, + "declaration-storage-mapping": { + "patterns": [ + { + "begin": "\\b(mapping)\\b", + "beginCaptures": { + "1": { + "name": "storage.type.mapping" + } + }, + "end": "(?=\\))", + "patterns": [ + { + "include": "#declaration-storage-mapping" + }, + { + "include": "#type-primitive" + }, + { + "include": "#punctuation" + }, + { + "include": "#operator" + } + ] + }, + { + "match": "\\b(mapping)\\b", + "name": "storage.type.mapping" + } + ] + }, + "declaration-error": { + "match": "\\b(error)(\\s+([A-Za-z_]\\w*))?\\b", + "captures": { + "1": { + "name": "storage.type.error" + }, + "3": { + "name": "entity.name.type.error" + } + } + }, + "function-call": { + "match": "\\b([A-Za-z_]\\w*)\\s*(\\()", + "captures": { + "1": { + "name": "entity.name.function" + }, + "2": { + "name": "punctuation.parameters.begin" + } + } + }, + "assembly": { + "patterns": [ + { + "match": "\\b(assembly)\\b", + "name": "keyword.control.assembly" + }, + { + "match": "\\b(let)\\b", + "name": "storage.type.assembly" + } + ] + }, + "punctuation": { + "patterns": [ + { + "match": ";", + "name": "punctuation.terminator.statement" + }, + { + "match": "\\.", + "name": "punctuation.accessor" + }, + { + "match": ",", + "name": "punctuation.separator" + }, + { + "match": "\\{", + "name": "punctuation.brace.curly.begin" + }, + { + "match": "\\}", + "name": "punctuation.brace.curly.end" + }, + { + "match": "\\[", + "name": "punctuation.brace.square.begin" + }, + { + "match": "\\]", + "name": "punctuation.brace.square.end" + }, + { + "match": "\\(", + "name": "punctuation.parameters.begin" + }, + { + "match": "\\)", + "name": "punctuation.parameters.end" + } + ] + } + }, + "scopeName": "source.solidity", + "uuid": "ad87d2cd-8575-4afe-984e-9421a3788933" + +} diff --git a/src/Stratis.VS.StratisEVM/README.html b/src/Stratis.VS.StratisEVM/README.html index 30adaaf..7d8bfdc 100644 --- a/src/Stratis.VS.StratisEVM/README.html +++ b/src/Stratis.VS.StratisEVM/README.html @@ -1,40 +1,30 @@ - -commonmark.js dingus - -clear permalink Smart punctuation -## Try CommonMark - -You can try CommonMark here. This dingus is powered by -[commonmark.js](https://github.com/commonmark/commonmark.js), the -JavaScript reference implementation. - -1. item one -2. item two - - sublist - - sublist - - Preview - HTML - AST - + +

About

The StratisEVM extension provides support for developing Stratis Solidity smart contracts inside Visual Studio.

Features

Requirements

Usage

-

Use the Visual Studio Open Folder... feature to open a folder with Solidity contracts.

-

The first time you open a folder with Solidity contracts the extension will install the necessary Node.js modules in the extension's private node_modules directory. -This will take a few seconds to complete so opening the folder will be slower than normal but after the modules are installed the first time, opening folders containing -Solidity contracts will be as usual.

\ No newline at end of file +

+ Use the Visual Studio Open Folder... feature to open a folder with Solidity contracts. Edit a Solidity file as normal. To compile a Solidity file, right-click + on the file in Solution Explorer and select 'Compile Solidity File'. +

+

+ The first time you open a folder with Solidity contracts the extension will install the necessary Node.js modules in the extension's private node_modules directory. + This will take a few seconds to complete so opening the folder will be slower than normal but after the modules are installed the first time, opening folders containing + Solidity contracts will be as usual. +

+ + \ No newline at end of file diff --git a/src/Stratis.VS.StratisEVM/README.md b/src/Stratis.VS.StratisEVM/README.md index b7a97c4..4db9092 100644 --- a/src/Stratis.VS.StratisEVM/README.md +++ b/src/Stratis.VS.StratisEVM/README.md @@ -4,7 +4,7 @@ The StratisEVM extension provides support for developing Stratis Solidity smart ## Features * Uses [vscode-solidity](https://github.com/juanfranblanco/vscode-solidity) language server * Integrates with Visual Studio "Open Folder" -* Syntax highlighting +* Syntax highlighting and hover information * Intellisense * Linting * Compiling a Solidity file from inside Visual Studio @@ -14,7 +14,8 @@ The StratisEVM extension provides support for developing Stratis Solidity smart * A recent version of [Node.js](https://nodejs.org/) ## Usage -Use the Visual Studio Open Folder... feature to open a folder with Solidity contracts. +Use the Visual Studio Open Folder... feature to open a folder with Solidity contracts. Edit a Solidity file as normal. To compile a Solidity file, right-click +on the file in Solution Explorer and select 'Compile Solidity File'. The first time you open a folder with Solidity contracts the extension will install the necessary Node.js modules in the extension's private `node_modules` directory. This will take a few seconds to complete so opening the folder will be slower than normal but after the modules are installed the first time, opening folders containing diff --git a/src/Stratis.VS.StratisEVM/Stratis.VS.StratisEVM.csproj b/src/Stratis.VS.StratisEVM/Stratis.VS.StratisEVM.csproj index e30f392..9c13e95 100644 --- a/src/Stratis.VS.StratisEVM/Stratis.VS.StratisEVM.csproj +++ b/src/Stratis.VS.StratisEVM/Stratis.VS.StratisEVM.csproj @@ -57,9 +57,6 @@ - - true - Always true @@ -79,6 +76,9 @@ true + + true + Designer diff --git a/tests/solidity/test2/BasicContract.sol b/tests/solidity/test2/BasicContract.sol index e81f094..5e464b8 100644 --- a/tests/solidity/test2/BasicContract.sol +++ b/tests/solidity/test2/BasicContract.sol @@ -14,6 +14,8 @@ contract BasicContract { // Uncomment this line, and the import of "hardhat/console.sol", to print a log in your terminal // console.log("Unlock time is %o and block timestamp is %o", unlockTime, block.timestamp); emit BasicEvent(funcArg); + + uint memory foo; }