Files
vscode/extensions/powershell/syntaxes/powershell.tmLanguage.json

1070 lines
26 KiB
JSON

{
"information_for_contributors": [
"This file has been converted from https://github.com/PowerShell/EditorSyntax/blob/master/PowerShellSyntax.tmLanguage",
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/PowerShell/EditorSyntax/commit/d605150f48952ba4bd28d7b389e97adc1a5d9b76",
"fileTypes": [
"ps1",
"psm1",
"psd1"
],
"name": "PowerShell",
"patterns": [
{
"begin": "(--%)",
"beginCaptures": {
"1": {
"name": "keyword.operator.powershell"
}
},
"comment": "Stop Parsing",
"end": "$",
"patterns": [
{
"include": "#lineComment"
},
{
"match": "(.)",
"name": "support.other.powershell"
}
]
},
{
"include": "#illegalBacktick"
},
{
"include": "#lineComment"
},
{
"include": "#blockComment"
},
{
"include": "#stringDoubleQuoted"
},
{
"include": "#stringSingleQuoted"
},
{
"include": "#stringDoubleQuotedHeredoc"
},
{
"include": "#stringSingleQuotedHeredoc"
},
{
"include": "#switch"
},
{
"include": "#scriptBlock"
},
{
"include": "#subExpression"
},
{
"include": "#arrayDeclaration"
},
{
"include": "#redirection"
},
{
"include": "#numericConstant"
},
{
"include": "#operators"
},
{
"include": "#type"
},
{
"include": "#function"
},
{
"include": "#enum"
},
{
"include": "#class"
},
{
"include": "#reservedWords"
},
{
"include": "#controlWords"
},
{
"include": "#commands"
},
{
"include": "#executableFiles"
},
{
"include": "#illegalVariable"
},
{
"include": "#variable"
}
],
"repository": {
"arrayDeclaration": {
"begin": "(\\@?\\()",
"beginCaptures": {
"0": {
"name": "keyword.other.powershell"
}
},
"end": "(\\))((\\.[\\w\"']+)*)",
"endCaptures": {
"1": {
"name": "keyword.other.powershell"
},
"2": {
"name": "entity.other.attribute-name.powershell"
}
},
"name": "meta.array.powershell",
"patterns": [
{
"include": "$self"
}
]
},
"blockComment": {
"begin": "(<#)",
"end": "(#>)",
"name": "comment.block.powershell",
"patterns": [
{
"include": "#commentEmbeddedDocs"
}
]
},
"class": {
"begin": "(?<!\\w|-)(?i:(class))\\s+(\\w+)(?:\\s*(:)\\s*(\\w+))?\\s*\\{",
"beginCaptures": {
"1": {
"name": "storage.type.powershell"
},
"2": {
"name": "entity.name.function.powershell"
},
"3": {
"name": "keyword.operator.powershell"
},
"4": {
"name": "entity.other.inherited-class.powershell"
}
},
"comment": "Class",
"end": "\\}",
"name": "meta.class.powershell",
"patterns": [
{
"include": "#classReservedWords"
},
{
"include": "#classBaseKeyword"
},
{
"include": "$self"
}
]
},
"classBaseKeyword": {
"captures": {
"1": {
"name": "keyword.operator.powershell"
},
"2": {
"name": "keyword.control.class.powershell"
}
},
"comment": "The base keyword used in classes.",
"match": "(:)\\s*(?i:(base))\\s*(?=\\()"
},
"classReservedWords": {
"comment": "Reserved words for classes.",
"match": "\\b(?i:(hidden|static))\\b",
"name": "keyword.other.powershell"
},
"commandParameter": {
"patterns": [
{
"comment": "-Parameter value",
"match": "\\s(-\\w+)(:)?",
"name": "variable.parameter.powershell"
}
]
},
"commands": {
"patterns": [
{
"begin": "(?<!\\\\)\\b((?i:(Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Mount|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Write))-(\\w+))\\b(?!\\.|\\\\)",
"beginCaptures": {
"1": {
"name": "support.function.powershell"
}
},
"comment": "Generic function match based on Verb-Noun pair using list of approved verbs.",
"end": "((?=\\))|(?=\\})|(?<!`)\\n|(?<!`)\\r|(\\|))",
"endCaptures": {
"2": {
"name": "keyword.operator.powershell"
}
},
"name": "meta.command.powershell",
"patterns": [
{
"include": "#scriptblock"
},
{
"include": "#commandParameter"
},
{
"include": "#lineComment"
},
{
"include": "#redirection"
},
{
"include": "#numericConstant"
},
{
"include": "#operators"
},
{
"include": "#variable"
},
{
"include": "#stringDoubleQuoted"
},
{
"include": "#stringSingleQuoted"
},
{
"include": "#arrayDeclaration"
},
{
"include": "#illegalBacktick"
},
{
"include": "#illegalVariable"
}
]
},
{
"begin": "(?<!\\\\)\\b(?i:foreach-object|tee-object|where-object|sort-object)\\b(?!\\.|\\\\)",
"beginCaptures": {
"0": {
"name": "support.function.powershell"
}
},
"comment": "Built-in commands that don't adhere to the approved verbs standard.",
"end": "((?=\\))|(?=\\})|(?<!`)\\n|(?<!`)\\r|(\\|))",
"endCaptures": {
"2": {
"name": "keyword.operator.powershell"
}
},
"name": "meta.command.powershell",
"patterns": [
{
"include": "#scriptblock"
},
{
"include": "#commandParameter"
},
{
"include": "#lineComment"
},
{
"include": "#redirection"
},
{
"include": "#numericConstant"
},
{
"include": "#operators"
},
{
"include": "#variable"
},
{
"include": "#stringDoubleQuoted"
},
{
"include": "#stringSingleQuoted"
},
{
"include": "#arrayDeclaration"
},
{
"include": "#illegalBacktick"
},
{
"include": "#illegalVariable"
}
]
},
{
"begin": "(?<!\\\\|\\[)\\b(?i:ac|asnp|cat|cd|cfs|chdir|clc|clear|clhy|cli|clp|cls|clv|cnsn|compare|copy|cp|cpi|cpp|curl|cvpa|dbp|del|diff|dir|dnsn|ebp|echo|epal|epcsv|epsn|erase|etsn|exsn|fc|fhx|fl|ft|fw|gal|gbp|gc|gcb|gci|gcm|gcs|gdr|ghy|gi|gjb|gl|gm|gmo|gp|gps|gpv|group|gsn|gsnp|gsv|gu|gv|gwmi|h|history|icm|iex|ihy|ii|ipal|ipcsv|ipmo|ipsn|irm|ise|iwmi|iwr|kill|lp|ls|man|md|measure|mi|mount|move|mp|mv|nal|ndr|ni|nmo|npssc|nsn|nv|ogv|oh|popd|ps|pushd|r|rbp|rcjb|rcsn|rd|rdr|ren|ri|rjb|rm|rmdir|rmo|rni|rnp|rp|rsn|rsnp|rujb|rv|rvpa|rwmi|sajb|sal|saps|sasv|sbp|sc|scb|select|set|shcm|si|sl|sleep|sls|sort|sp|spjb|spps|spsv|start|sujb|sv|swmi|tee|trcm|type|wget|wjb|write)\\b(?!\\.|\\\\|\\])",
"beginCaptures": {
"0": {
"name": "support.function.powershell"
}
},
"comment": "Built-in aliases",
"end": "((?=\\))|(?=\\})|(?<!`)\\n|(?<!`)\\r|(\\|))",
"endCaptures": {
"2": {
"name": "keyword.operator.powershell"
}
},
"name": "meta.command.powershell",
"patterns": [
{
"include": "#scriptblock"
},
{
"include": "#commandParameter"
},
{
"include": "#lineComment"
},
{
"include": "#redirection"
},
{
"include": "#numericConstant"
},
{
"include": "#operators"
},
{
"include": "#variable"
},
{
"include": "#stringDoubleQuoted"
},
{
"include": "#stringSingleQuoted"
},
{
"include": "#arrayDeclaration"
},
{
"include": "#illegalBacktick"
},
{
"include": "#illegalVariable"
}
]
},
{
"begin": "(\\b(([A-Za-z0-9\\-_\\.]+).(?i:ps1))\\b)",
"beginCaptures": {
"0": {
"name": "support.function.powershell"
}
},
"comment": "External script",
"end": "((?=\\))|(?=\\})|(?<!`)\\n|(?<!`)\\r|(\\|))",
"endCaptures": {
"2": {
"name": "keyword.operator.powershell"
}
},
"name": "meta.command.powershell",
"patterns": [
{
"include": "#scriptblock"
},
{
"include": "#commandParameter"
},
{
"include": "#lineComment"
},
{
"include": "#redirection"
},
{
"include": "#numericConstant"
},
{
"include": "#operators"
},
{
"include": "#variable"
},
{
"include": "#stringDoubleQuoted"
},
{
"include": "#stringSingleQuoted"
},
{
"include": "#arrayDeclaration"
},
{
"include": "#illegalBacktick"
},
{
"include": "#illegalVariable"
}
]
}
]
},
"commentEmbeddedDocs": {
"patterns": [
{
"captures": {
"1": {
"name": "keyword.operator.documentation.powershell"
},
"2": {
"name": "keyword.operator.documentation.powershell"
}
},
"match": "(?i:(\\.)(SYNOPSIS|DESCRIPTION|EXAMPLE|INPUTS|OUTPUTS|NOTES|LINK|COMPONENT|FUNCTIONALITY|ROLE)\\b)",
"name": "comment.documentation.embedded.powershell"
},
{
"captures": {
"1": {
"name": "keyword.operator.documentation.powershell"
},
"2": {
"name": "keyword.operator.documentation.powershell"
},
"3": {
"name": "constant.string.documentation.powershell"
}
},
"match": "(?i:(\\.)(PARAMETER|FORWARDHELPTARGETNAME|FORWARDHELPCATEGORY|REMOTEHELPRUNSPACE|EXTERNALHELP)\\s+(.+))",
"name": "comment.documentation.embedded.powershell"
},
{
"captures": {
"1": {
"name": "keyword.operator.documentation.powershell"
},
"2": {
"name": "constant.string.documentation.powershell"
}
},
"comment": "Requires -Version",
"match": "(?i:(requires))\\s(-(?i:version)\\s\\d+(\\.\\d+)?)",
"name": "comment.documentation.embedded.powershell"
},
{
"captures": {
"1": {
"name": "keyword.operator.documentation.powershell"
},
"2": {
"name": "constant.string.documentation.powershell"
}
},
"comment": "Requires -PSSnapin",
"match": "(?i:(requires))\\s(-(?i:pssnapin)\\s\\w+(\\s*-(?i:version)\\s\\d+(\\.\\d+)?)?)",
"name": "comment.documentation.embedded.powershell"
},
{
"captures": {
"1": {
"name": "keyword.operator.documentation.powershell"
},
"2": {
"name": "constant.string.documentation.powershell"
}
},
"comment": "Requires -Modules",
"match": "(?i:(requires))\\s(-(?i:modules)\\s.*)",
"name": "comment.documentation.embedded.powershell"
},
{
"captures": {
"1": {
"name": "keyword.operator.documentation.powershell"
},
"2": {
"name": "constant.string.documentation.powershell"
}
},
"comment": "Requires -ShellId",
"match": "(?i:(requires))\\s(-(?i:shellid)\\s.*)",
"name": "comment.documentation.embedded.powershell"
},
{
"captures": {
"1": {
"name": "keyword.operator.documentation.powershell"
},
"2": {
"name": "constant.string.documentation.powershell"
}
},
"comment": "Requires -RunAsAdministrator",
"match": "(?i:(requires))\\s(-(?i:runasadministrator))",
"name": "comment.documentation.embedded.powershell"
}
]
},
"controlWords": {
"match": "(\\b(?<!-|\\$)(?i:begin|process|exit|break|return|catch|finally|for|continue|foreach|throw|from|trap|try|do|if|until|in|using|else|elseif|while|end|where)\\b(?!-|\\.))",
"name": "keyword.control.powershell"
},
"defaultKeyword": {
"captures": {
"0": {
"name": "keyword.other.powershell"
}
},
"comment": "Default is a reserved word when used in Switch statements. This is kind of a work-around - it will highlight only inside scriptblocks.",
"match": "(?i:(default))\\s*(?=\\{)"
},
"enum": {
"captures": {
"1": {
"name": "storage.type.powershell"
},
"2": {
"name": "entity.name.function"
}
},
"comment": "capture should be entity.name.type, but it doesn't provide a good color in the default schema.",
"match": "(?<!\\w|-)(?i:(enum))\\s+(\\w+)\\s+"
},
"executableFiles": {
"comment": "Executable files, like exe, com, cmd and bat",
"match": "(\\b(([A-Za-z0-9\\-_\\.]+).(?i:exe|com|cmd|bat))\\b)",
"name": "support.function.powershell"
},
"function": {
"begin": "(?<!\\S)(?i)(function|filter|workflow|configuration)\\s+(?:(global|local|script|private):)?((?:\\p{L}|\\d|_|-|\\.)+)",
"beginCaptures": {
"0": {
"name": "meta.function"
},
"1": {
"name": "storage.type"
},
"2": {
"name": "storage.modifier.scope.powershell"
},
"3": {
"name": "entity.name.function.powershell"
}
},
"end": "\\{|\\(",
"patterns": [
{
"include": "#lineComment"
}
]
},
"hashTable": {
"begin": "(@\\{)",
"end": "(\\})",
"name": "meta.hashtable.powershell",
"patterns": [
{
"include": "$self"
}
]
},
"illegalBacktick": {
"comment": "Any characters (other than new line) after a back-tick, is illegal in PowerShell.",
"match": "(`(?!$))",
"name": "invalid.illegal.powershell"
},
"illegalVariable": {
"match": "\\$\\w+:\\s",
"name": "invalid.illegal.powershell"
},
"lineComment": {
"begin": "(^#|\\s#)",
"comment": "Line comment - must start with new line or at least one whitespace character before the '#'.",
"end": "$",
"name": "comment.line.number-sign.powershell",
"patterns": [
{
"include": "#commentEmbeddedDocs"
}
]
},
"numericConstant": {
"patterns": [
{
"comment": "Real [(+|-)] digits . digits [e [(+|-)] digits] [(d|l)] [(kb|mb|gb|tb|pb)]",
"match": "(?<!\\w)([-+]?)\\d+\\.\\d+(?i:e(\\+|-){0,1}\\d+){0,1}(?i:d|l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\\w|\\d)",
"name": "constant.numeric.real.powershell"
},
{
"comment": "Real [(+|-)] . digits [e [(+|-)] digits] [(d|l)] [(kb|mb|gb|tb|pb)]",
"match": "(?<!\\.|\\d|\\w)([-+]?)\\.\\d+(?i:e(\\+|-){0,1}\\d+){0,1}(?i:d|l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\\w|\\d)",
"name": "constant.numeric.real.powershell"
},
{
"comment": "Real [(+|-)] digits . [e [(+|-)] digits] [(d|l)] [(kb|mb|gb|tb|pb)]",
"match": "(?<!\\w)([-+]?)(?<!\\d)\\d+\\.(?i:e(\\+|-){0,1}\\d+){0,1}(?i:d|l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\\w|\\d|\\.)",
"name": "constant.numeric.real.powershell"
},
{
"comment": "Integer [(+|-)] digits [(d|l)] [(kb|mb|gb|tb|pb)]",
"match": "(?<!\\w|\\w\\.)([-+]?)\\d+(?i:d|l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\\w|\\d)",
"name": "constant.numeric.integer.powershell"
},
{
"comment": "Real [(+|-)] digits [e [(+|-)] digits] [(d|l)] [(kb|mb|gb|tb|pb)]",
"match": "(?<!\\w|\\.)([-+]?)(?<!\\d)\\d+(?i:e(\\+|-){0,1}\\d+){0,1}(?i:d|l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\\w|\\d|\\.)",
"name": "constant.numeric.real.powershell"
},
{
"comment": "Hexadecimal 0x 0-f [l] [kb|mb|gb|tb|pb]",
"match": "(?<!\\w|\\d)([-+]?)(?i:0x)(?i:[0-9a-f])+(?i:l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\\w|\\d)",
"name": "constant.numeric.hexadecimal.powershell"
}
]
},
"operators": {
"patterns": [
{
"comment": "Comparison",
"match": "(?<=\\d|\\s|^)-(?i:as|is|isnot|in|notin|join|((c|i)?(eq|ne|gt|lt|ge|le|like|notlike|split|replace|contains|notcontains|match|notmatch))|shl|shr)\\b(?!\\.|\\\\)",
"name": "keyword.operator.comparison.powershell"
},
{
"comment": "Bitwise",
"match": "(?<=\\d|\\s|^)-(?i:band|bor|bxor|bnot|shr|shl)\\b",
"name": "keyword.operator.bitwise.powershell"
},
{
"comment": "Logical",
"match": "(?<=\\d|\\s|^)-(?i:and|or|xor)\\b",
"name": "keyword.operator.logical.powershell"
},
{
"comment": "Format",
"match": "(?<=\\d|\\s|^)-(?i:f)\\b",
"name": "keyword.operator.format.powershell"
},
{
"comment": "Assignment",
"match": "(=|-=|\\+=|\\*=|/=|%=)",
"name": "keyword.operator.assignment.powershell"
},
{
"comment": "Logical NOT",
"match": "(?<=\\d|\\s|^)((?i:-not)|!)",
"name": "keyword.operator.unary.logical-not.powershell"
},
{
"comment": "Multiplicative",
"match": "([*/%])(?!\\.)",
"name": "keyword.operator.multiplicative.powershell"
},
{
"comment": "Unary Plus",
"match": "([+](?=\\$|\\(|\"))",
"name": "keyword.operator.unary-plus.powershell"
},
{
"comment": "Unary Minus",
"match": "([-](?=\\$|\\(|\"))",
"name": "keyword.operator.unary-minus.powershell"
},
{
"comment": "Additive",
"match": "([+-])(?!\\{|\\p{L}|@)",
"name": "keyword.operator.additive.powershell"
},
{
"comment": "Range",
"match": "(\\.\\.)",
"name": "keyword.operator.range.powershell"
},
{
"comment": "Command invocation (Call)",
"match": "(&|\\|)",
"name": "keyword.operator.other.powershell"
}
]
},
"redirection": {
"patterns": [
{
"comment": "Merging redirection",
"match": "(?<=\\s|^)([2-6\\*]?>&1)",
"name": "keyword.operator.redirection.powershell"
},
{
"comment": "File redirection",
"match": "(?<=\\s|^)(([1-6\\*]?>{1,2})|(<))",
"name": "keyword.operator.redirection.powershell"
}
]
},
"reservedWords": {
"match": "(\\b(?<!-|\\$)(?i:configuration|node|enum|filter|sequence|class|data|define|function|dynamicparam|inlinescript|var|parallel|param|workflow)\\b(?!-|\\.))",
"name": "keyword.other.powershell"
},
"scriptBlock": {
"begin": "(\\{)",
"end": "(\\})",
"name": "meta.scriptblock.powershell",
"patterns": [
{
"include": "$self"
},
{
"include": "#defaultKeyword"
}
]
},
"stringDoubleQuoted": {
"begin": "((?<!\\\")\\\")",
"end": "(\\\"(?!\\\"))",
"name": "string.quoted.double.powershell",
"patterns": [
{
"include": "#illegalVariable"
},
{
"include": "#stringEscapeChars"
},
{
"include": "#variableWithoutPropertyHighlighting"
},
{
"include": "#subExpression"
}
]
},
"stringDoubleQuotedHeredoc": {
"begin": "(\\@\"\\s*$)",
"end": "^\"\\@",
"name": "string.quoted.double.heredoc.powershell",
"patterns": [
{
"include": "#illegalVariable"
},
{
"include": "#stringEscapeChars"
},
{
"include": "#variableWithoutPropertyHighlighting"
},
{
"include": "#subExpression"
},
{
"include": "#scriptBlock"
}
]
},
"stringEscapeChars": {
"patterns": [
{
"match": "(`[0abfnrtv\"'$`])",
"name": "constant.character.escape.powershell"
},
{
"match": "(\"\")",
"name": "constant.character.escape.powershell"
}
]
},
"stringSingleQuoted": {
"begin": "((?<!')')",
"end": "('(?!'))",
"name": "string.quoted.single.powershell",
"patterns": [
{
"include": "#stringSingleQuotedDouble"
}
]
},
"stringSingleQuotedDouble": {
"match": "('')",
"name": "constant.character.escape.powershell"
},
"stringSingleQuotedHeredoc": {
"begin": "(\\@'\\s*$)",
"end": "^'\\@",
"name": "string.quoted.single.heredoc.powershell",
"patterns": [
{
"include": "#stringSingleQuotedDouble"
}
]
},
"subExpression": {
"begin": "(\\$\\()",
"captures": {
"0": {
"name": "keyword.other.powershell"
}
},
"end": "(\\))",
"name": "meta.subexpression.powershell",
"patterns": [
{
"include": "$self"
},
{
"match": "(.)",
"name": "source.powershell"
}
]
},
"switch": {
"patterns": [
{
"captures": {
"1": {
"name": "keyword.control.powershell"
},
"2": {
"name": "variable.parameter.powershell"
},
"4": {
"name": "variable.parameter.powershell"
},
"5": {
"name": "variable.parameter.powershell"
}
},
"comment": "switch [-regex|-wildcard|-exact][-casesensitive] -file filename",
"match": "\\b(?i:(switch))\\b\\s+(?i:(-regex|-wildcard|-exact){0,1})\\s*(?i:(-casesensitive){0,1})\\s*(?i:(-file))\\s+"
},
{
"captures": {
"1": {
"name": "keyword.control.powershell"
},
"2": {
"name": "variable.parameter.powershell"
},
"3": {
"name": "variable.parameter.powershell"
}
},
"comment": "switch [-regex|-wildcard|-exact][-casesensitive] (<value>)",
"match": "\\b(?i:(switch))\\b\\s+(?i:(-regex|-wildcard|-exact){0,1})\\s*(?i:(-casesensitive){0,1})\\s*"
}
]
},
"type": {
"begin": "\\[",
"beginCaptures": {
"0": {
"name": "keyword.other.powershell"
}
},
"comment": "Type []",
"end": "(\\])(::[\\w]+)*((\\.[\\w\"']+)*)",
"endCaptures": {
"1": {
"name": "keyword.other.powershell"
},
"2": {
"name": "meta.method.powershell"
},
"3": {
"name": "entity.other.attribute-name.powershell"
}
},
"patterns": [
{
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "keyword.other.powershell"
}
},
"comment": "Parenthesis ()",
"end": "\\)",
"endCaptures": {
"0": {
"name": "keyword.other.powershell"
}
},
"patterns": [
{
"include": "$self"
},
{
"comment": "Reserved words within [( )]",
"match": "\\b(?i)(mandatory|valuefrompipeline|valuefrompipelinebypropertyname|valuefromremainingarguments|position|parametersetname|defaultparametersetname|supportsshouldprocess|positionalbinding|helpuri|confirmimpact|helpmessage)\\b",
"name": "entity.other.attribute-name.powershell"
}
]
},
{
"include": "$self"
},
{
"match": "(.(`){0,2}(\\d){0,2})",
"name": "entity.name.type"
}
]
},
"variable": {
"patterns": [
{
"comment": "Invalid variable name",
"match": "(\\$)(\\w+-\\w+)\\b",
"name": "invalid.illegal.powershell"
},
{
"captures": {
"1": {
"name": "constant.language.powershell"
},
"2": {
"name": "constant.language.powershell"
},
"3": {
"name": "entity.other.attribute-name.powershell"
}
},
"comment": "Automatic variables - read-only.",
"match": "(\\$)(?i:(_|args|consolefilename|error|event|eventsubscriber|executioncontext|false|foreach|home|host|input|lastexitcode|matches|myinvocation|nestedpromptlevel|null|pid|psboundparameters|pscmdlet|psculture|psdebugcontext|pshome|psitem|psscriptroot|psuiculture|psversiontable|pwd|sender|shellid|sourceargs|sourceeventargs|switch|this|true))\\b((\\.[\\w\"'\\- @#]+)*)"
},
{
"captures": {
"1": {
"name": "keyword.other.powershell"
},
"2": {
"name": "storage.modifier.scope.powershell"
},
"3": {
"name": "variable.other.readwrite.powershell"
},
"4": {
"name": "variable.other.readwrite.powershell"
},
"5": {
"name": "entity.other.attribute-name.powershell"
}
},
"comment": "$var, $local:var",
"match": "(\\$)((?i:global|local|script|private|using|env|function|alias|cert|variable|hkcu|hklm|wsman):)?(\\w+)(:\\w+)?((\\.[\\w\"'\\- @#]+)*)"
},
{
"captures": {
"1": {
"name": "keyword.other.powershell"
},
"2": {
"name": "keyword.other.powershell"
},
"3": {
"name": "storage.modifier.scope.powershell"
},
"4": {
"name": "variable.other.readwrite.powershell"
},
"5": {
"name": "keyword.other.powershell"
},
"6": {
"name": "entity.other.attribute-name.powershell"
}
},
"comment": "${var}, ${script:var}",
"match": "(\\$)(\\{)((?i:global|local|script|private|using|env|function|alias|cert|variable|hkcu|hklm|wsman):)?(.+?)(\\})((\\.[\\w\"'\\- @#]+)*)"
},
{
"captures": {
"1": {
"name": "keyword.other.powershell"
},
"2": {
"name": "variable.other.readwrite.powershell"
}
},
"comment": "Splatting",
"match": "(@)(\\w+)"
}
]
},
"variableWithoutPropertyHighlighting": {
"patterns": [
{
"comment": "Invalid variable name",
"match": "(\\$)(\\w+-\\w+)\\b",
"name": "invalid.illegal.powershell"
},
{
"captures": {
"1": {
"name": "constant.language.powershell"
},
"2": {
"name": "constant.language.powershell"
}
},
"comment": "Automatic variables - read-only.",
"match": "(\\$)(?i:(_|args|consolefilename|error|event|eventsubscriber|executioncontext|false|foreach|home|host|input|lastexitcode|matches|myinvocation|nestedpromptlevel|null|pid|psboundparameters|pscmdlet|psculture|psdebugcontext|pshome|psitem|psscriptroot|psuiculture|psversiontable|pwd|sender|shellid|sourceargs|sourceeventargs|switch|this|true))\\b"
},
{
"captures": {
"1": {
"name": "keyword.other.powershell"
},
"2": {
"name": "storage.modifier.scope.powershell"
},
"3": {
"name": "variable.other.readwrite.powershell"
},
"4": {
"name": "variable.other.readwrite.powershell"
}
},
"comment": "$var, $local:var",
"match": "(\\$)((?i:global|local|script|private|using|env|function|alias|cert|variable|hkcu|hklm|wsman):)?(\\w+)(:\\w+)?"
},
{
"captures": {
"1": {
"name": "keyword.other.powershell"
},
"2": {
"name": "keyword.other.powershell"
},
"3": {
"name": "storage.modifier.scope.powershell"
},
"4": {
"name": "variable.other.readwrite.powershell"
},
"5": {
"name": "keyword.other.powershell"
}
},
"comment": "${var}, ${script:var}",
"match": "(\\$)(\\{)((?i:global|local|script|private|using|env|function|alias|cert|variable|hkcu|hklm|wsman):)?(.+?)(\\})"
},
{
"captures": {
"1": {
"name": "keyword.other.powershell"
},
"2": {
"name": "variable.other.readwrite.powershell"
}
},
"comment": "Splatting",
"match": "(@)(\\w+)"
}
]
}
},
"scopeName": "source.powershell",
"uuid": "f8f5ffb0-503e-11df-9879-0800200c9a66"
}