{ "displayName": "PowerShell", "name": "powershell", "patterns": [ { "begin": "<#", "beginCaptures": { "0": { "name": "punctuation.definition.comment.block.begin.powershell" } }, "end": "#>", "endCaptures": { "0": { "name": "punctuation.definition.comment.block.end.powershell" } }, "name": "comment.block.powershell", "patterns": [ { "include": "#commentEmbeddedDocs" } ] }, { "match": "[2-6]>&1|>>?|<<|[<>]|>\\||[1-6]>|[1-6]>>", "name": "keyword.operator.redirection.powershell" }, { "include": "#commands" }, { "include": "#commentLine" }, { "include": "#variable" }, { "include": "#subexpression" }, { "include": "#function" }, { "include": "#attribute" }, { "include": "#UsingDirective" }, { "include": "#type" }, { "include": "#hashtable" }, { "include": "#doubleQuotedString" }, { "include": "#scriptblock" }, { "include": "#doubleQuotedStringEscapes" }, { "applyEndPatternLast": true, "begin": "['‘-‛]", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.powershell" } }, "end": "['‘-‛]", "endCaptures": { "0": { "name": "punctuation.definition.string.end.powershell" } }, "name": "string.quoted.single.powershell", "patterns": [ { "match": "['‘-‛]{2}", "name": "constant.character.escape.powershell" } ] }, { "begin": "(@[\"“”„])\\s*$", "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.powershell" } }, "end": "^[\"“”„]@", "endCaptures": { "0": { "name": "punctuation.definition.string.end.powershell" } }, "name": "string.quoted.double.heredoc.powershell", "patterns": [ { "include": "#variableNoProperty" }, { "include": "#doubleQuotedStringEscapes" }, { "include": "#interpolation" } ] }, { "begin": "(@['‘-‛])\\s*$", "beginCaptures": { "1": { "name": "punctuation.definition.string.begin.powershell" } }, "end": "^['‘-‛]@", "endCaptures": { "0": { "name": "punctuation.definition.string.end.powershell" } }, "name": "string.quoted.single.heredoc.powershell" }, { "include": "#numericConstant" }, { "begin": "(@)(\\()", "beginCaptures": { "1": { "name": "keyword.other.array.begin.powershell" }, "2": { "name": "punctuation.section.group.begin.powershell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.section.group.end.powershell" } }, "name": "meta.group.array-expression.powershell", "patterns": [ { "include": "$self" } ] }, { "begin": "((\\$))(\\()", "beginCaptures": { "1": { "name": "keyword.other.substatement.powershell" }, "2": { "name": "punctuation.definition.subexpression.powershell" }, "3": { "name": "punctuation.section.group.begin.powershell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.section.group.end.powershell" } }, "name": "meta.group.complex.subexpression.powershell", "patterns": [ { "include": "$self" } ] }, { "match": "\\b((([-.0-9A-Z_a-z]+)\\.(?i:exe|com|cmd|bat)))\\b", "name": "support.function.powershell" }, { "match": "(?{1,5})}", "name": "constant.character.escape.powershell" }, { "match": "`u(?:\\{\\h{0,6}.)?", "name": "invalid.character.escape.powershell" } ] }, "variable": { "patterns": [ { "captures": { "0": { "name": "constant.language.powershell" }, "1": { "name": "punctuation.definition.variable.powershell" } }, "match": "(\\$)(?i:(False|Null|True))\\b" }, { "captures": { "0": { "name": "support.constant.variable.powershell" }, "1": { "name": "punctuation.definition.variable.powershell" }, "3": { "name": "variable.other.member.powershell" } }, "match": "(\\$)(?i:(Error|ExecutionContext|Host|Home|PID|PsHome|PsVersionTable|ShellID))((?:\\.[_\\p{L}\\d]+)*\\b)?\\b" }, { "captures": { "0": { "name": "support.variable.automatic.powershell" }, "1": { "name": "punctuation.definition.variable.powershell" }, "3": { "name": "variable.other.member.powershell" } }, "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)((?:\\.[_\\p{L}\\d]+)*\\b)?" }, { "captures": { "0": { "name": "variable.language.powershell" }, "1": { "name": "punctuation.definition.variable.powershell" }, "3": { "name": "variable.other.member.powershell" } }, "match": "(\\$)(?i:(ConfirmPreference|DebugPreference|ErrorActionPreference|ErrorView|FormatEnumerationLimit|InformationPreference|LogCommandHealthEvent|LogCommandLifecycleEvent|LogEngineHealthEvent|LogEngineLifecycleEvent|LogProviderHealthEvent|LogProviderLifecycleEvent|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount|MaximumHistoryCount|MaximumVariableCount|OFS|OutputEncoding|PSCulture|PSDebugContext|PSDefaultParameterValues|PSEmailServer|PSItem|PSModuleAutoLoadingPreference|PSModuleAutoloadingPreference|PSSenderInfo|PSSessionApplicationName|PSSessionConfigurationName|PSSessionOption|ProgressPreference|VerbosePreference|WarningPreference|WhatIfPreference))((?:\\.[_\\p{L}\\d]+)*\\b)?\\b" }, { "captures": { "0": { "name": "variable.other.readwrite.powershell" }, "1": { "name": "punctuation.definition.variable.powershell" }, "2": { "name": "storage.modifier.scope.powershell" }, "4": { "name": "variable.other.member.powershell" } }, "match": "(?i:([$@])(global|local|private|script|using|workflow):([_\\p{L}\\d]+))((?:\\.[_\\p{L}\\d]+)*\\b)?" }, { "captures": { "0": { "name": "variable.other.readwrite.powershell" }, "1": { "name": "punctuation.definition.variable.powershell" }, "2": { "name": "punctuation.section.braces.begin.powershell" }, "3": { "name": "storage.modifier.scope.powershell" }, "5": { "name": "punctuation.section.braces.end.powershell" }, "6": { "name": "variable.other.member.powershell" } }, "match": "(?i:(\\$)(\\{)(global|local|private|script|using|workflow):([^}]*[^`}])(}))((?:\\.[_\\p{L}\\d]+)*\\b)?" }, { "captures": { "0": { "name": "variable.other.readwrite.powershell" }, "1": { "name": "punctuation.definition.variable.powershell" }, "2": { "name": "support.variable.drive.powershell" }, "4": { "name": "variable.other.member.powershell" } }, "match": "(?i:([$@])([_\\p{L}\\d]+:)?([_\\p{L}\\d]+))((?:\\.[_\\p{L}\\d]+)*\\b)?" }, { "captures": { "0": { "name": "variable.other.readwrite.powershell" }, "1": { "name": "punctuation.definition.variable.powershell" }, "2": { "name": "punctuation.section.braces.begin.powershell" }, "3": { "name": "support.variable.drive.powershell" }, "5": { "name": "punctuation.section.braces.end.powershell" }, "6": { "name": "variable.other.member.powershell" } }, "match": "(?i:(\\$)(\\{)([_\\p{L}\\d]+:)?([^}]*[^`}])(}))((?:\\.[_\\p{L}\\d]+)*\\b)?" } ] }, "variableNoProperty": { "patterns": [ { "captures": { "0": { "name": "constant.language.powershell" }, "1": { "name": "punctuation.definition.variable.powershell" } }, "match": "(\\$)(?i:(False|Null|True))\\b" }, { "captures": { "0": { "name": "support.constant.variable.powershell" }, "1": { "name": "punctuation.definition.variable.powershell" }, "3": { "name": "variable.other.member.powershell" } }, "match": "(\\$)(?i:(Error|ExecutionContext|Host|Home|PID|PsHome|PsVersionTable|ShellID))\\b" }, { "captures": { "0": { "name": "support.variable.automatic.powershell" }, "1": { "name": "punctuation.definition.variable.powershell" }, "3": { "name": "variable.other.member.powershell" } }, "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": { "0": { "name": "variable.language.powershell" }, "1": { "name": "punctuation.definition.variable.powershell" }, "3": { "name": "variable.other.member.powershell" } }, "match": "(\\$)(?i:(ConfirmPreference|DebugPreference|ErrorActionPreference|ErrorView|FormatEnumerationLimit|InformationPreference|LogCommandHealthEvent|LogCommandLifecycleEvent|LogEngineHealthEvent|LogEngineLifecycleEvent|LogProviderHealthEvent|LogProviderLifecycleEvent|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount|MaximumHistoryCount|MaximumVariableCount|OFS|OutputEncoding|PSCulture|PSDebugContext|PSDefaultParameterValues|PSEmailServer|PSItem|PSModuleAutoLoadingPreference|PSModuleAutoloadingPreference|PSSenderInfo|PSSessionApplicationName|PSSessionConfigurationName|PSSessionOption|ProgressPreference|VerbosePreference|WarningPreference|WhatIfPreference))\\b" }, { "captures": { "0": { "name": "variable.other.readwrite.powershell" }, "1": { "name": "punctuation.definition.variable.powershell" }, "2": { "name": "storage.modifier.scope.powershell" }, "4": { "name": "variable.other.member.powershell" } }, "match": "(?i:(\\$)(global|local|private|script|using|workflow):([_\\p{L}\\d]+))" }, { "captures": { "0": { "name": "variable.other.readwrite.powershell" }, "1": { "name": "punctuation.definition.variable.powershell" }, "2": { "name": "storage.modifier.scope.powershell" }, "4": { "name": "keyword.other.powershell" }, "5": { "name": "variable.other.member.powershell" } }, "match": "(?i:(\\$)(\\{)(global|local|private|script|using|workflow):([^}]*[^`}])(}))" }, { "captures": { "0": { "name": "variable.other.readwrite.powershell" }, "1": { "name": "punctuation.definition.variable.powershell" }, "2": { "name": "support.variable.drive.powershell" }, "4": { "name": "variable.other.member.powershell" } }, "match": "(?i:(\\$)([_\\p{L}\\d]+:)?([_\\p{L}\\d]+))" }, { "captures": { "0": { "name": "variable.other.readwrite.powershell" }, "1": { "name": "punctuation.definition.variable.powershell" }, "2": { "name": "punctuation.section.braces.begin" }, "3": { "name": "support.variable.drive.powershell" }, "5": { "name": "punctuation.section.braces.end" } }, "match": "(?i:(\\$)(\\{)([_\\p{L}\\d]+:)?([^}]*[^`}])(}))" } ] } }, "scopeName": "source.powershell" }