mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
898 lines
23 KiB
JSON
898 lines
23 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/e6e207044299a7121b4ed92c9762f51e1c23d0dd",
|
|
"name": "PowerShell",
|
|
"scopeName": "source.powershell",
|
|
"patterns": [
|
|
{
|
|
"begin": "<#",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "punctuation.start.definition.comment.block.powershell"
|
|
}
|
|
},
|
|
"end": "#>",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "punctuation.end.definition.comment.block.powershell"
|
|
}
|
|
},
|
|
"name": "comment.block.powershell",
|
|
"patterns": [
|
|
{
|
|
"include": "#commentEmbeddedDocs"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"begin": "(?<![`\\\\-])#",
|
|
"end": "$",
|
|
"name": "comment.line.number-sign.powershell",
|
|
"patterns": [
|
|
{
|
|
"include": "#commentEmbeddedDocs"
|
|
},
|
|
{
|
|
"include": "#RequiresDirective"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"match": "[2-6]>&1|>>|>|<<|<|>|>\\||[1-6]>|[1-6]>>",
|
|
"name": "keyword.operator.redirection.powershell"
|
|
},
|
|
{
|
|
"include": "#commands"
|
|
},
|
|
{
|
|
"include": "#variable"
|
|
},
|
|
{
|
|
"include": "#interpolatedStringContent"
|
|
},
|
|
{
|
|
"include": "#function"
|
|
},
|
|
{
|
|
"include": "#attribute"
|
|
},
|
|
{
|
|
"include": "#UsingDirective"
|
|
},
|
|
{
|
|
"include": "#type"
|
|
},
|
|
{
|
|
"include": "#hashtable"
|
|
},
|
|
{
|
|
"begin": "(?<!(?<!`)\")\"",
|
|
"end": "\"(?!\")",
|
|
"name": "string.quoted.double.powershell",
|
|
"patterns": [
|
|
{
|
|
"include": "#variableNoProperty"
|
|
},
|
|
{
|
|
"include": "#doubleQuotedStringEscapes"
|
|
},
|
|
{
|
|
"include": "#interpolation"
|
|
},
|
|
{
|
|
"match": "`\\s*$",
|
|
"name": "keyword.other.powershell"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"comment": "Needed to parse stuff correctly in 'argument mode'. (See about_parsing.)",
|
|
"include": "#doubleQuotedStringEscapes"
|
|
},
|
|
{
|
|
"begin": "(?<!')'",
|
|
"end": "'(?!')",
|
|
"name": "string.quoted.single.powershell",
|
|
"patterns": [
|
|
{
|
|
"match": "''",
|
|
"name": "constant.character.escape.powershell"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"begin": "\\@\"(?=$)",
|
|
"end": "^\"@",
|
|
"name": "string.quoted.double.heredoc.powershell",
|
|
"patterns": [
|
|
{
|
|
"include": "#variableNoProperty"
|
|
},
|
|
{
|
|
"include": "#doubleQuotedStringEscapes"
|
|
},
|
|
{
|
|
"include": "#interpolation"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"begin": "\\@'(?=$)",
|
|
"end": "^'@",
|
|
"name": "string.quoted.single.heredoc.powershell",
|
|
"patterns": [
|
|
{
|
|
"match": "''",
|
|
"name": "constant.character.escape.powershell"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"include": "#numericConstant"
|
|
},
|
|
{
|
|
"begin": "@\\(",
|
|
"captures": {
|
|
"0": {
|
|
"name": "keyword.other.powershell"
|
|
}
|
|
},
|
|
"end": "\\)",
|
|
"name": "meta.group.array-expression.powershell",
|
|
"patterns": [
|
|
{
|
|
"include": "$self"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"begin": "\\$\\(",
|
|
"captures": {
|
|
"0": {
|
|
"name": "keyword.other.powershell"
|
|
}
|
|
},
|
|
"comment": "TODO: move to repo; make recursive.",
|
|
"end": "\\)",
|
|
"name": "meta.group.complex.subexpression.powershell",
|
|
"patterns": [
|
|
{
|
|
"include": "$self"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"match": "(?<!\\w)-([ci]?[lg][te]|eq|ne)",
|
|
"name": "keyword.operator.logical.powershell"
|
|
},
|
|
{
|
|
"match": "(\\b(([A-Za-z0-9\\-_\\.]+)\\.(?i:exe|com|cmd|bat))\\b)",
|
|
"name": "support.function.powershell"
|
|
},
|
|
{
|
|
"match": "(?<!\\w)((?i:begin|break|catch|continue|data|define|do|dynamicparam|else|elseif|end|exit|finally|for|foreach(?!-object)|from|if|in|inlinescript|parallel|param|process|return|switch|throw|trap|try|until|var|where(?!-object)|while)|%|\\?)(?!\\w)",
|
|
"name": "keyword.control.powershell"
|
|
},
|
|
{
|
|
"comment": "This should only be relevant inside a class but will require a rework of how classes are matched. This is a temp fix.",
|
|
"match": "(?<!\\w)((?i:hidden|static))(?!\\w)",
|
|
"name": "storage.modifier.powershell"
|
|
},
|
|
{
|
|
"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:class)|%|\\?)(?:\\s)+((?:\\p{L}|\\d|_|-|)+)\\b"
|
|
},
|
|
{
|
|
"match": "(?<!\\w)-(?i:is(?:not)?|as)\\b",
|
|
"name": "keyword.operator.comparison.powershell"
|
|
},
|
|
{
|
|
"match": "(?<!\\w)-(?i:[ic]?(?:eq|ne|[gl][te]|(?:not)?(?:like|match|contains|in)|replace))(?!\\p{L})",
|
|
"name": "keyword.operator.comparison.powershell"
|
|
},
|
|
{
|
|
"match": "(?<!\\w)-(?i:join|split)(?!\\p{L})|!",
|
|
"name": "keyword.operator.unary.powershell"
|
|
},
|
|
{
|
|
"match": "(?<!\\w)-(?i:and|or|not|xor)(?!\\p{L})|!",
|
|
"name": "keyword.operator.logical.powershell"
|
|
},
|
|
{
|
|
"match": "(?<!\\w)-(?i:band|bor|bnot|bxor)(?!\\p{L})",
|
|
"name": "keyword.operator.bitwise.powershell"
|
|
},
|
|
{
|
|
"match": "(?<!\\w)-(?i:f)(?!\\p{L})",
|
|
"name": "keyword.operator.string-format.powershell"
|
|
},
|
|
{
|
|
"match": "[+%*/-]?=|[+/*%-]",
|
|
"name": "keyword.operator.assignment.powershell"
|
|
},
|
|
{
|
|
"match": "\\|{2}|&{2}|;",
|
|
"name": "keyword.other.statement-separator.powershell"
|
|
},
|
|
{
|
|
"match": "&|(?<!\\w)\\.(?= )|`|,|\\|",
|
|
"name": "keyword.operator.other.powershell"
|
|
},
|
|
{
|
|
"comment": "This is very imprecise, is there a syntax for 'must come after...' ",
|
|
"match": "(?<!\\s|^)\\.\\.(?=\\d|\\(|\\$)",
|
|
"name": "keyword.operator.range.powershell"
|
|
}
|
|
],
|
|
"repository": {
|
|
"attribute": {
|
|
"begin": "\\[(\\p{L}|\\.|``\\d+)+(?=\\()",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "entity.name.tag"
|
|
},
|
|
"1": {
|
|
"name": "entity.name.tag"
|
|
}
|
|
},
|
|
"end": "\\]",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "entity.name.tag"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"begin": "\\(",
|
|
"end": "\\)",
|
|
"name": "entity.other.attribute-name",
|
|
"patterns": [
|
|
{
|
|
"captures": {
|
|
"0": {
|
|
"name": "entity.other.attribute.parameter.powershell"
|
|
},
|
|
"1": {
|
|
"name": "constant.language.powershell"
|
|
},
|
|
"2": {
|
|
"name": "variable.other.powershell"
|
|
}
|
|
},
|
|
"comment": "really we should match the known attributes first",
|
|
"match": "(\\w+)\\s*=?([^\"']*?|'[^']*?'|\"[^\"]*?\")?(?=,|\\))",
|
|
"name": "entity.other.attribute-name.powershell"
|
|
},
|
|
{
|
|
"include": "#variable"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"commands": {
|
|
"patterns": [
|
|
{
|
|
"comment": "Verb-Noun pattern:",
|
|
"match": "(?:(\\p{L}|\\d|_|-|\\\\|\\:)*\\\\)?\\b(?i:Add|Approve|Assert|Backup|Block|Build|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Deploy|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)\\-.+?(?:\\.(?i:exe|cmd|bat|ps1))?\\b",
|
|
"name": "support.function.powershell"
|
|
},
|
|
{
|
|
"comment": "Builtin cmdlets with reserved verbs",
|
|
"match": "(?<!\\w)(?i:foreach-object)(?!\\w)",
|
|
"name": "support.function.powershell"
|
|
},
|
|
{
|
|
"comment": "Builtin cmdlets with reserved verbs",
|
|
"match": "(?<!\\w)(?i:where-object)(?!\\w)",
|
|
"name": "support.function.powershell"
|
|
},
|
|
{
|
|
"comment": "Builtin cmdlets with reserved verbs",
|
|
"match": "(?<!\\w)(?i:sort-object)(?!\\w)",
|
|
"name": "support.function.powershell"
|
|
},
|
|
{
|
|
"comment": "Builtin cmdlets with reserved verbs",
|
|
"match": "(?<!\\w)(?i:tee-object)(?!\\w)",
|
|
"name": "support.function.powershell"
|
|
}
|
|
]
|
|
},
|
|
"commentEmbeddedDocs": {
|
|
"patterns": [
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "constant.string.documentation.powershell"
|
|
},
|
|
"2": {
|
|
"name": "keyword.operator.documentation.powershell"
|
|
}
|
|
},
|
|
"match": "(?i:\\s*(\\.)(COMPONENT|DESCRIPTION|EXAMPLE|EXTERNALHELP|FORWARDHELPCATEGORY|FORWARDHELPTARGETNAME|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|REMOTEHELPRUNSPACE|ROLE|SYNOPSIS))",
|
|
"name": "comment.documentation.embedded.powershell"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "constant.string.documentation.powershell"
|
|
},
|
|
"2": {
|
|
"name": "keyword.operator.documentation.powershell"
|
|
},
|
|
"3": {
|
|
"name": "keyword.operator.documentation.powershell"
|
|
}
|
|
},
|
|
"match": "(?i:\\s*(\\.)(PARAMETER|FORWARDHELPTARGETNAME|FORWARDHELPCATEGORY|REMOTEHELPRUNSPACE|EXTERNALHELP)\\s+([a-z0-9-_]+))",
|
|
"name": "comment.documentation.embedded.powershell"
|
|
}
|
|
]
|
|
},
|
|
"doubleQuotedStringEscapes": {
|
|
"patterns": [
|
|
{
|
|
"match": "`[0abnfrvt\"'$`]",
|
|
"name": "constant.character.escape.powershell"
|
|
},
|
|
{
|
|
"match": "\"\"",
|
|
"name": "constant.character.escape.powershell"
|
|
}
|
|
]
|
|
},
|
|
"function": {
|
|
"begin": "^(?:\\s*+)(?i)(function|filter|configuration|workflow)\\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": "\\{|\\("
|
|
},
|
|
"interpolatedStringContent": {
|
|
"begin": "\\(",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "keyword.other.powershell"
|
|
}
|
|
},
|
|
"contentName": "interpolated.simple.source.powershell",
|
|
"end": "\\)",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "keyword.other.powershell"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"include": "$self"
|
|
},
|
|
{
|
|
"include": "#interpolation"
|
|
},
|
|
{
|
|
"include": "#interpolatedStringContent"
|
|
}
|
|
]
|
|
},
|
|
"interpolation": {
|
|
"begin": "(\\$)\\(",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "keyword.other.powershell"
|
|
}
|
|
},
|
|
"contentName": "interpolated.complex.source.powershell",
|
|
"end": "\\)",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "keyword.other.powershell"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"include": "$self"
|
|
},
|
|
{
|
|
"include": "#interpolation"
|
|
},
|
|
{
|
|
"include": "#interpolatedStringContent"
|
|
}
|
|
]
|
|
},
|
|
"numericConstant": {
|
|
"patterns": [
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "constant.numeric.hexadecimal.powershell"
|
|
},
|
|
"2": {
|
|
"name": "keyword.other.powershell"
|
|
}
|
|
},
|
|
"match": "(?<!\\w)([-+]?0(?:x|X)[0-9a-fA-F_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\\b",
|
|
"name": "constant.numeric.hexadecimal.powershell"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "constant.numeric.scientific.powershell"
|
|
},
|
|
"2": {
|
|
"name": "keyword.other.powershell"
|
|
}
|
|
},
|
|
"match": "(?<!\\w)([-+]?(?:[0-9_]+)?\\.[0-9_]+(?:(?:e|E)[0-9]+)?(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\\b",
|
|
"name": "constant.numeric.scientific.powershell"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "constant.numeric.binary.powershell"
|
|
},
|
|
"2": {
|
|
"name": "keyword.other.powershell"
|
|
}
|
|
},
|
|
"match": "(?<!\\w)([-+]?0(?:b|B)[01_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\\b",
|
|
"name": "constant.numeric.binary.powershell"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "constant.numeric.decimal.powershell"
|
|
},
|
|
"2": {
|
|
"name": "keyword.other.powershell"
|
|
}
|
|
},
|
|
"match": "(?<!\\w)([-+]?[0-9_]+(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\\b",
|
|
"name": "constant.numeric.decimal.powershell"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "constant.numeric.decimal.powershell"
|
|
},
|
|
"2": {
|
|
"name": "keyword.other.powershell"
|
|
}
|
|
},
|
|
"match": "(?<!\\w)([-+]?[0-9_]+\\.(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\\b",
|
|
"name": "constant.numeric.decimal.powershell"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "constant.numeric.decimal.powershell"
|
|
},
|
|
"2": {
|
|
"name": "keyword.other.powershell"
|
|
}
|
|
},
|
|
"match": "(?<!\\w)([-+]?[0-9_]+[\\.]?(?:F|f|D|d|M|m))((?i:[kmgtp]b)?)\\b",
|
|
"name": "constant.numeric.decimal.powershell"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "constant.numeric.decimal.powershell"
|
|
},
|
|
"2": {
|
|
"name": "keyword.other.powershell"
|
|
}
|
|
},
|
|
"match": "(?<!\\w)([-+]?[0-9_]+[\\.]?(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\\b",
|
|
"name": "constant.numeric.decimal.powershell"
|
|
}
|
|
]
|
|
},
|
|
"scriptblock": {
|
|
"begin": "\\{",
|
|
"end": "\\}",
|
|
"name": "meta.scriptblock.powershell",
|
|
"patterns": [
|
|
{
|
|
"include": "$self"
|
|
}
|
|
]
|
|
},
|
|
"type": {
|
|
"begin": "\\[",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "entity.other.attribute-name"
|
|
}
|
|
},
|
|
"comment": "name should be entity.name.type but default schema doesn't have a good color for it",
|
|
"end": "\\]",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "entity.other.attribute-name"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"match": "(\\p{L}|\\.|``\\d+)+?",
|
|
"name": "entity.other.attribute-name"
|
|
},
|
|
{
|
|
"include": "$self"
|
|
}
|
|
]
|
|
},
|
|
"variable": {
|
|
"patterns": [
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"2": {
|
|
"name": "constant.language.powershell"
|
|
}
|
|
},
|
|
"comment": "These are special constants.",
|
|
"match": "(\\$)(?i:(False|Null|True))\\b"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"2": {
|
|
"name": "support.constant.variable.powershell"
|
|
},
|
|
"3": {
|
|
"name": "entity.name.function.invocation.powershell"
|
|
}
|
|
},
|
|
"comment": "These are the other built-in constants.",
|
|
"match": "(\\$)(?i:(Error|ExecutionContext|Host|Home|PID|PsHome|PsVersionTable|ShellID))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?\\b"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"2": {
|
|
"name": "support.constant.automatic.powershell"
|
|
},
|
|
"3": {
|
|
"name": "entity.name.function.invocation.powershell"
|
|
}
|
|
},
|
|
"comment": "Automatic variables are not constants, but they are read-only. In monokai (default) color schema support.variable doesn't have color, so we use constant.",
|
|
"match": "(\\$)(?i:(\\$|\\^|\\?|_|Args|ConsoleFileName|Event|EventArgs|EventSubscriber|ForEach|Input|LastExitCode|Matches|MyInvocation|NestedPromptLevel|Profile|PSBoundParameters|PsCmdlet|PsCulture|PSDebugContext|PSItem|PSCommandPath|PSScriptRoot|PsUICulture|Pwd|Sender|SourceArgs|SourceEventArgs|StackTrace|Switch|This))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?\\b"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"2": {
|
|
"name": "variable.language.powershell"
|
|
},
|
|
"3": {
|
|
"name": "entity.name.function.invocation.powershell"
|
|
}
|
|
},
|
|
"comment": "Style preference variables as language variables so that they stand out.",
|
|
"match": "(\\$)(?i:(ConfirmPreference|DebugPreference|ErrorActionPreference|ErrorView|FormatEnumerationLimit|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount|MaximumHistoryCount|MaximumVariableCount|OFS|OutputEncoding|ProgressPreference|PsCulture|PSDebugContext|PSDefaultParameterValues|PSEmailServer|PSItem|PSModuleAutoloadingPreference|PSSenderInfo|PSSessionApplicationName|PSSessionConfigurationName|PSSessionOption|VerbosePreference|WarningPreference|WhatIfPreference))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?\\b"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"2": {
|
|
"name": "storage.modifier.scope.powershell"
|
|
},
|
|
"3": {
|
|
"name": "variable.other.normal.powershell"
|
|
},
|
|
"4": {
|
|
"name": "entity.name.function.invocation.powershell"
|
|
}
|
|
},
|
|
"match": "(?i:(\\$|@)(global|local|private|script|using|workflow):((?:\\p{L}|\\d|_)+))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"2": {
|
|
"name": "storage.modifier.scope.powershell"
|
|
},
|
|
"3": {
|
|
"name": "variable.other.readwrite.powershell"
|
|
},
|
|
"4": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"5": {
|
|
"name": "entity.name.function.invocation.powershell"
|
|
}
|
|
},
|
|
"match": "(?i:(\\$\\{)(global|local|private|script|using|workflow):([^}]*[^}`])(\\}))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"2": {
|
|
"name": "support.variable.drive.powershell"
|
|
},
|
|
"3": {
|
|
"name": "variable.other.readwrite.powershell"
|
|
},
|
|
"4": {
|
|
"name": "entity.name.function.invocation.powershell"
|
|
}
|
|
},
|
|
"match": "(?i:(\\$|@)((?:\\p{L}|\\d|_)+:)?((?:\\p{L}|\\d|_)+))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"2": {
|
|
"name": "support.variable.drive.powershell"
|
|
},
|
|
"3": {
|
|
"name": "variable.other.readwrite.powershell"
|
|
},
|
|
"4": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"5": {
|
|
"name": "entity.name.function.invocation.powershell"
|
|
}
|
|
},
|
|
"match": "(?i:(\\$\\{)((?:\\p{L}|\\d|_)+:)?([^}]*[^}`])(\\}))((?:\\.(?:\\p{L}|\\d|_)+)*\\b)?"
|
|
}
|
|
]
|
|
},
|
|
"UsingDirective": {
|
|
"match": "(?<!\\w)(?i:(using))\\s+(?i:(namespace|module))\\s+(?i:((?:\\w+(?:\\.)?)+))",
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.control.using.powershell"
|
|
},
|
|
"2": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"3": {
|
|
"name": "variable.parameter.powershell"
|
|
}
|
|
}
|
|
},
|
|
"RequiresDirective": {
|
|
"begin": "(?<=#)(?i:(requires))\\s",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "keyword.control.requires.powershell"
|
|
}
|
|
},
|
|
"end": "$",
|
|
"name": "meta.requires.powershell",
|
|
"patterns": [
|
|
{
|
|
"match": "\\-(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version)",
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
{
|
|
"match": "(?<!-)\\b\\p{L}+|\\d+(?:\\.\\d+)*",
|
|
"name": "variable.parameter.powershell"
|
|
},
|
|
{
|
|
"include": "#hashtable"
|
|
}
|
|
]
|
|
},
|
|
"variableNoProperty": {
|
|
"patterns": [
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"2": {
|
|
"name": "constant.language.powershell"
|
|
}
|
|
},
|
|
"comment": "These are special constants.",
|
|
"match": "(\\$)(?i:(False|Null|True))\\b"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"2": {
|
|
"name": "support.constant.variable.powershell"
|
|
},
|
|
"3": {
|
|
"name": "entity.name.function.invocation.powershell"
|
|
}
|
|
},
|
|
"comment": "These are the other built-in constants.",
|
|
"match": "(\\$)(?i:(Error|ExecutionContext|Host|Home|PID|PsHome|PsVersionTable|ShellID))\\b"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"2": {
|
|
"name": "support.variable.automatic.powershell"
|
|
},
|
|
"3": {
|
|
"name": "entity.name.function.invocation.powershell"
|
|
}
|
|
},
|
|
"comment": "Automatic variables are not constants, but they are read-only...",
|
|
"match": "(\\$)(?i:(\\$|\\^|\\?|_|Args|ConsoleFileName|Event|EventArgs|EventSubscriber|ForEach|Input|LastExitCode|Matches|MyInvocation|NestedPromptLevel|Profile|PSBoundParameters|PsCmdlet|PsCulture|PSDebugContext|PSItem|PSCommandPath|PSScriptRoot|PsUICulture|Pwd|Sender|SourceArgs|SourceEventArgs|StackTrace|Switch|This))\\b"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"2": {
|
|
"name": "variable.language.powershell"
|
|
},
|
|
"3": {
|
|
"name": "entity.name.function.invocation.powershell"
|
|
}
|
|
},
|
|
"comment": "Style preference variables as language variables so that they stand out.",
|
|
"match": "(\\$)(?i:(ConfirmPreference|DebugPreference|ErrorActionPreference|ErrorView|FormatEnumerationLimit|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount|MaximumHistoryCount|MaximumVariableCount|OFS|OutputEncoding|ProgressPreference|PsCulture|PSDebugContext|PSDefaultParameterValues|PSEmailServer|PSItem|PSModuleAutoloadingPreference|PSSenderInfo|PSSessionApplicationName|PSSessionConfigurationName|PSSessionOption|VerbosePreference|WarningPreference|WhatIfPreference))\\b"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"2": {
|
|
"name": "storage.modifier.scope.powershell"
|
|
},
|
|
"3": {
|
|
"name": "variable.other.normal.powershell"
|
|
},
|
|
"4": {
|
|
"name": "entity.name.function.invocation.powershell"
|
|
}
|
|
},
|
|
"match": "(?i:(\\$|@)(global|local|private|script|using|workflow):((?:\\p{L}|\\d|_)+))"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"2": {
|
|
"name": "storage.modifier.scope.powershell"
|
|
},
|
|
"3": {
|
|
"name": "variable.other.readwrite.powershell"
|
|
},
|
|
"4": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"5": {
|
|
"name": "entity.name.function.invocation.powershell"
|
|
}
|
|
},
|
|
"match": "(?i:(\\$\\{)(global|local|private|script|using|workflow):([^}]*[^}`])(\\}))"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"2": {
|
|
"name": "support.variable.drive.powershell"
|
|
},
|
|
"3": {
|
|
"name": "variable.other.readwrite.powershell"
|
|
},
|
|
"4": {
|
|
"name": "entity.name.function.invocation.powershell"
|
|
}
|
|
},
|
|
"match": "(?i:(\\$)((?:\\p{L}|\\d|_)+:)?((?:\\p{L}|\\d|_)+))"
|
|
},
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"2": {
|
|
"name": "support.variable.drive.powershell"
|
|
},
|
|
"3": {
|
|
"name": "variable.other.readwrite.powershell"
|
|
},
|
|
"4": {
|
|
"name": "keyword.other.powershell"
|
|
},
|
|
"5": {
|
|
"name": "entity.name.function.invocation.powershell"
|
|
}
|
|
},
|
|
"match": "(?i:(\\$\\{)((?:\\p{L}|\\d|_)+:)?([^}]*[^}`])(\\}))"
|
|
}
|
|
]
|
|
},
|
|
"hashtable": {
|
|
"begin": "(@\\{)",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "punctuation.section.braces.begin"
|
|
}
|
|
},
|
|
"end": "(\\})",
|
|
"endCaptures": {
|
|
"1": {
|
|
"name": "punctuation.section.braces.end"
|
|
}
|
|
},
|
|
"name": "meta.hashtable.powershell",
|
|
"patterns": [
|
|
{
|
|
"captures": {
|
|
"1": {
|
|
"name": "punctuation.definition.string.begin"
|
|
},
|
|
"2": {
|
|
"name": "variable.other.readwrite.powershell"
|
|
},
|
|
"3": {
|
|
"name": "punctuation.definition.string.end"
|
|
},
|
|
"4": {
|
|
"name": "keyword.operator.assignment.powershell"
|
|
}
|
|
},
|
|
"match": "\\b((?:\\'|\\\")?)(\\w+)((?:\\'|\\\")?)(?:\\s+)?(=)(?:\\s+)?",
|
|
"name": "meta.hashtable.assignment.powershell"
|
|
},
|
|
{
|
|
"include": "#scriptblock"
|
|
},
|
|
{
|
|
"include": "$self"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
} |