fileTypes ps1 psm1 psd1 name Powershell v2 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.powershell patterns include #commentEmbeddedDocs include #variable include #scriptblock begin (?<!(?<!`)")" end "(?!") name string.quoted.double.powershell patterns include #variable 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 #interpolation 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 begin @'$ end ^'@$ name string.quoted.double.heredoc.powershell include #numericConstant match -([lg][te]|[ci]?(eq|ne)) name keyword.operator.logical.powershell include #PSDefaults match (?i:[a-z][a-z0-9]+-[a-z][a-z0-9]+) name support.function.powershell match \b(?i:if|else|elseif|switch|while|default|try|finally|catch|for|do|until|break|continue|foreach|return|filter|in|trap|throw|param|begin|process|end|function|global|local|private|script|contained)\b name keyword.control.powershell match -(?i:(?:[ic]?eq|ne|[gl][te]|(?:not)?(?:like|match|contains)|replace)|is(?:not)?|as|and|or|band|bor|not|f)\b name keyword.operator.comparison.powershell match -(?i:and|or|not)|! name keyword.operator.logical.powershell match -(?i:f|band|bor|-bnot)\b name keyword.operator.bitwise.powershell match -f\b name keyword.operator.string-format.powershell match [+%*/-]?=|[+/*%-] name keyword.operator.assignment.powershell match 2>&1|>>|>|<<|<|>|>\||2>|2>>|1>> name keyword.operator.redirection.powershell match \|{2}|&{2}|; name keyword.other.statement-separator.powershell match &|(?<!\w)\.(?= )|`|,|\| name keyword.operator.other.powershell repository PSDefaults comment Default commandlets in Powershell v2 match Disconnect-(WSMan)|Exit-(PSSession)|Copy-(Item|ItemProperty)|Resolve-(Path)|Group-(Object)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|Variable|WmiObject|WSManInstance)|Unregister-(Event|PSSessionConfiguration)|Tee-(Object)|Pop-(Location)|Set-(Acl|Alias|AuthenticodeSignature|Content|Date|ExecutionPolicy|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance|WSManInstance|WSManQuickConfig)|Format-(Custom|List|Table|Wide)|Invoke-(Command|Expression|History|Item|WmiMethod|WSManAction)|Export-(Alias|Clixml|Console|Counter|Csv|FormatData|ModuleMember|PSSession)|Update-(FormatData|List|TypeData)|Sort-(Object)|Measure-(Command|Object)|ForEach-(Object)|Connect-(WSMan)|Suspend-(Service)|ConvertFrom-(Csv|SecureString|StringData)|Where-(Object)|Rename-(Item|ItemProperty)|Convert-(Path)|Select-(Object|String|Xml)|Import-(Alias|Clixml|Counter|Csv|LocalizedData|Module|PSSession)|Stop-(Computer|Job|Process|Service|Transcript)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionOption|Service|TimeSpan|Variable|WebServiceProxy|WSManInstance|WSManSessionOption)|Resume-(Service)|Show-(EventLog)|Out-(Default|File|GridView|Host|Null|Printer|String)|Undo-(Transaction)|Trace-(Command)|Clear-(Content|EventLog|History|Item|ItemProperty|Variable)|Push-(Location)|Split-(Path)|Disable-(ComputerRestore|PSBreakpoint|PSSessionConfiguration|WSManCredSSP)|Reset-(ComputerMachinePassword)|Restore-(Computer)|ConvertTo-(Csv|Html|SecureString|Xml)|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration|WSManCredSSP)|Join-(Path)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Compare-(Object)|Get-(Acl|Alias|AuthenticodeSignature|ChildItem|Command|ComputerRestorePoint|Content|Counter|Credential|Culture|Date|Event|EventLog|EventSubscriber|ExecutionPolicy|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|PfxCertificate|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|UICulture|Unique|Variable|WinEvent|WmiObject|WSManCredSSP|WSManInstance)|Receive-(Job)|Move-(Item|ItemProperty)|Add-(Computer|Content|History|Member|PSSnapin|Type)|Wait-(Event|Job|Process)|Send-(MailMessage)|Read-(Host)|Complete-(Transaction)|Checkpoint-(Computer)|Debug-(Process)|Use-(Transaction)|Restart-(Computer|Service)|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning)|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|WSMan)|Start-(Job|Process|Service|Sleep|Transaction|Transcript)|Limit-(EventLog)|Enter-(PSSession) name support.function.builtin.powershell commentEmbeddedDocs patterns captures 1 name constant.string.documentation.powershell 2 name keyword.operator.documentation.powershell match (?i:\s*(\.)(SYNOPSIS|DESCRIPTION|EXAMPLE|INPUTS|OUTPUTS|NOTES|LINK|COMPONENT|FUNCTIONALITY)) 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 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 support.constant.powershell 2 name keyword.operator.math.powershell 3 name support.constant.powershell 4 name keyword.other.powershell match (?i:\d+(E)(\+|\-)\d+(d)?(mb|kb|gb)?) name constant.numeric.scientific.powershell captures 1 name support.constant.powershell 2 name keyword.other.powershell match (?i:(0x)[a-f0-9]+(mb|kb|gb)?) name constant.numeric.hexadecimal.powershell captures 1 name support.constant.powershell 2 name support.constant.powershell 3 name keyword.other.powershell match \d*(?<!\.)(\.)\d+(d)?(mb|kb|gb)? name constant.numeric.double.powershell captures 1 name support.constant.powershell 2 name keyword.other.powershell match (?<!\w)\d+(d)?(mb|kb|gb)?(?!\w) name constant.numeric.powershell scriptblock begin \{ end \} name meta.scriptblock.powershell patterns include $self variable patterns captures 1 name keyword.other.powershell 2 name constant.numeric.powershell comment Style var name as numeric constant so that they stand out. match (\$)(?i:(\$|\?|\^|args|ConfirmPreference|ConsoleFileName|DebugPreference|Error|ErrorActionPreference|ErrorView|ExecutionContext|false|FormatEnumerationLimit|HOME|Host|input|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount|MaximumHistoryCount|MaximumVariableCount|MyInvocation|NestedPromptLevel|null|OutputEncoding|PID|PROFILE|ProgressPreference|PSBoundParameters|PSCulture|PSEmailServer|PSHOME|PSSessionApplicationName|PSSessionConfigurationName|PSSessionOption|PSUICulture|PSVersionTable|PWD|ReportErrorShowExceptionClass|ReportErrorShowInnerException|ReportErrorShowSource|ReportErrorShowStackTrace|ShellId|StackTrace|true|VerbosePreference|WarningPreference|WhatIfPreference))\b name support.variable.builtin.powershell captures 1 name keyword.other.variable.powershell 2 name storage.modifier.scope.powershell 3 name variable.other.readwrite.powershell match (?i:(\$)(?:(private|script|global):)?([a-z0-9_]+)) captures 1 name keyword.other.variable.powershell 2 name variable.other.readwrite.powershell 3 name storage.modifier.scope.powershell match (?i:(\$)(\{(?:(private|script|global):)?.+?\})) scopeName source.powershell uuid f8f5ffb0-503e-11df-9879-0800200c9a66