@@ -147,7 +147,7 @@ contexts:
147147 2: keyword.other.powershell
148148 3: variable.parameter.powershell
149149 attribute:
150− - match: '(\[)\s*\b(?i)(cmdletbinding|alias|outputtype|parameter|validatenotnull|validatenotnullorempty|validatecount|validateset|allownull|allowemptycollection|allowemptystring|validatescript|validaterange|validatepattern|validatelength)\b'
150+ - match: '(\[)\s*\b(?i)(cmdletbinding|alias|outputtype|parameter|validatenotnull|validatenotnullorempty|validatecount|validateset|allownull|allowemptycollection|allowemptystring|validatescript|validaterange|validatepattern|validatelength|supportswildcards)\b'
151151 captures:
152152 1: punctuation.section.bracket.begin.powershell
153153 2: support.function.attribute.powershell
@@ -165,31 +165,11 @@ contexts:
165165 captures:
166166 0: punctuation.section.group.end.powershell
167167 pop: true
168− - include: variable
169− - include: variableNoProperty
170− - include: hashtable
171− - include: scriptblock
172− - include: doubleQuotedStringEscapes
173− - include: doubleQuotedString
174− - include: type
175− - include: numericConstant
176− - include: doubleQuotedString
177168 - include: main
178169 - match: (?i)\b(mandatory|valuefrompipeline|valuefrompipelinebypropertyname|valuefromremainingarguments|position|parametersetname|defaultparametersetname|supportsshouldprocess|supportspaging|positionalbinding|helpuri|confirmimpact|helpmessage)\b(?:\s+)?(=)?
179170 captures:
180171 1: variable.parameter.attribute.powershell
181172 2: keyword.operator.assignment.powershell
182− - match: (?<!')'
183− captures:
184− 0: punctuation.definition.string.begin.powershell
185− push:
186− - meta_scope: string.quoted.single.powershell
187− - match: "'(?!')"
188− captures:
189− 0: punctuation.definition.string.end.powershell
190− pop: true
191− - match: "''"
192− scope: constant.character.escape.powershell
193173 commands:
194174 - 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'
195175 comment: "Verb-Noun pattern:"
@@ -242,14 +222,14 @@ contexts:
242222 pop: true
243223 - match: '(?i)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,64}\b'
244224 - include: variableNoProperty
245− - include: variable
246225 - include: doubleQuotedStringEscapes
247226 - include: interpolation
248227 - match: '`\s*$'
249228 scope: keyword.other.powershell
250229 doubleQuotedStringEscapes:
251− - match: '`[0abnfrvt"''$`]'
230+ - match: '`[`0abefnrtv"''$]'
252231 scope: constant.character.escape.powershell
232+ - include: unicodeEscape
253233 - match: '""'
254234 scope: constant.character.escape.powershell
255235 function:
@@ -362,6 +342,11 @@ contexts:
362342 - match: '(?!\d+|\.)(?:\p{L}|\p{N}|\.)+'
363343 scope: storage.type.powershell
364344 - include: main
345+ unicodeEscape:
346+ - match: '`u\{(?:(?:10)?([0-9a-fA-F]){1,4}|0?\g<1>{1,5})}'
347+ scope: constant.character.escape.powershell
348+ - match: '`u(?:\{[0-9a-fA-F]{,6}.)?'
349+ scope: invalid.character.escape.powershell
365350 variable:
366351 - match: (\$)(?i:(False|Null|True))\b
367352 comment: These are special constants.
@@ -374,13 +359,13 @@ contexts:
374359 0: support.constant.variable.powershell
375360 1: punctuation.definition.variable.powershell
376361 3: variable.other.member.powershell
377− - 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'
362+ - 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)?'
378363 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.
379364 captures:
380− 0: support.constant.automatic.powershell
365+ 0: support.variable.automatic.powershell
381366 1: punctuation.definition.variable.powershell
382367 3: variable.other.member.powershell
383− - 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'
368+ - 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'
384369 comment: Style preference variables as language variables so that they stand out.
385370 captures:
386371 0: variable.language.powershell
@@ -426,19 +411,19 @@ contexts:
426411 0: support.constant.variable.powershell
427412 1: punctuation.definition.variable.powershell
428413 3: variable.other.member.powershell
429− - 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
414+ - 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)'
430415 comment: Automatic variables are not constants, but they are read-only...
431416 captures:
432417 0: support.variable.automatic.powershell
433418 1: punctuation.definition.variable.powershell
434419 3: variable.other.member.powershell
435− - 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
420+ - 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
436421 comment: Style preference variables as language variables so that they stand out.
437422 captures:
438423 0: variable.language.powershell
439424 1: punctuation.definition.variable.powershell
440425 3: variable.other.member.powershell
441− - match: '(?i:(\$|@)(global|local|private|script|using|workflow):((?:\p{L}|\d|_)+))'
426+ - match: '(?i:(\$)(global|local|private|script|using|workflow):((?:\p{L}|\d|_)+))'
442427 captures:
443428 0: variable.other.readwrite.powershell
444429 1: punctuation.definition.variable.powershell