@@ -10,9 +10,10 @@ file_extensions:
1010 - psd1
1111
1212first_line_match : |
13- (?x)
13+ (?x:
1414 ^\#!.*\b(?:pwsh|powershell)\b
1515 | ^\# \s* -\*- [^*]* mode: \s* powershell [^*]* -\*-
16+ )
1617
1718variables :
1819 dec_digits : (?:[\d_]*\d)
@@ -252,9 +253,13 @@ contexts:
252253 - match : |-
253254 (?xi:
254255 (\[)\s*
255- (CmdletBinding|Alias|OutputType|Parameter
256- |Validate(?:Count|NotNull(?:OrEmpty)?|Range|Pattern|Length|Set|Script)
257- |Allow(?:Null|Empty(?:Collection|String))
256+ (
257+ CmdletBinding | Alias | OutputType | Parameter
258+ | Validate
259+ (?:
260+ Count | NotNull(?:OrEmpty)? | Range | Pattern | Length | Set
261+ | Script)
262+ | Allow(?: Null | Empty(?: Collection | String ))
258263 )\b
259264 )
260265 captures:
@@ -282,10 +287,12 @@ contexts:
282287 - include: main
283288 - match: |-
284289 (?xi:
285- \b(Mandatory|ValueFromPipeline(?:ByPropertyName)?
286- |ValueFromRemainingArguments|Position
287- |(?:Default)?ParameterSetName|SupportsShouldProcess
288- |PositionalBinding|HelpUri|ConfirmImpact|HelpMessage)
290+ \b(
291+ Mandatory | ValueFromPipeline(?:ByPropertyName)?
292+ | ValueFromRemainingArguments | Position
293+ | (?:Default)?ParameterSetName | SupportsShouldProcess
294+ | PositionalBinding | HelpUri | ConfirmImpact | HelpMessage
295+ )
289296 \s*(=)
290297 )
291298 captures:
@@ -306,17 +313,21 @@ contexts:
306313 - match : |-
307314 (?x:
308315 (?:[\w\\:-]*\\)? # Path stuff
309- \b(?i:Add|Approve|Assert|Backup|Block|Build|Checkpoint|Clear|Close # "Official" Verbs
310- |Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom
311- |ConvertTo|Copy|Debug|Deny|Deploy|Disable|Disconnect|Dismount|Edit
312- |Enable|Enter|Exit|Expand|Export|Find|Format|Get|Grant|Group|Hide
313- |Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge
314- |Mount|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push
315- |Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset
316- |Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select
317- |Send|Set|Show|Skip|Split|Start|Step|Stop|Submit|Suspend|Switch
318- |Sync|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish
319- |Unregister|Update|Use|Wait|Watch|Write
316+ \b(?i:
317+ Add | Approve | Assert | Backup | Block | Build | Checkpoint # "Official" Verbs
318+ | Clear | Close | Compare | Complete | Compress | Confirm | Connect
319+ | Convert | ConvertFrom | ConvertTo | Copy | Debug | Deny | Deploy
320+ | Disable | Disconnect | Dismount | Edit | Enable | Enter | Exit
321+ | Expand | Export | Find | Format | Get | Grant | Group | Hide
322+ | Import | Initialize | Install | Invoke | Join | Limit | Lock
323+ | Measure | Merge | Mount | Move | New | Open | Optimize | Out | Ping
324+ | Pop | Protect | Publish | Push | Read | Receive | Redo | Register
325+ | Remove | Rename | Repair | Request | Reset | Resize | Resolve
326+ | Restart | Restore | Resume | Revoke | Save | Search | Select | Send
327+ | Set | Show | Skip | Split | Start | Step | Stop | Submit | Suspend
328+ | Switch | Sync | Test | Trace | Unblock | Undo | Uninstall | Unlock
329+ | Unprotect | Unpublish | Unregister | Update | Use | Wait | Watch
330+ | Write
320331 )
321332 \-\w+? # Any "noun"
322333 (?:\.(?i:exe|cmd|bat|ps1))?\b # More path stuff
@@ -342,8 +353,11 @@ contexts:
342353 - match : |-
343354 (?xi:
344355 ^\s*(\.)
345- (Component|Description|Example|ForwardHelpTargetName|Functionality
346- |Inputs|Notes|Outputs|RemoteHelpRunSpace|Role|Synopsis)
356+ (
357+ Component | Description | Example | ForwardHelpTargetName
358+ | Functionality | Inputs | Notes | Outputs | RemoteHelpRunSpace
359+ | Role | Synopsis
360+ )
347361 )
348362 scope: comment.documentation.embedded.powershell
349363 captures:
@@ -542,14 +556,14 @@ contexts:
542556 (?:
543557 (?:
544558 (?:(\.(?!\.))\d*) # No `_` after the `.`
545- {{dec_exponent}}?
546- | {{dec_exponent}}
559+ {{dec_exponent}}?
560+ | {{dec_exponent}}
547561 )
548562 ({{float_suffix}})?
549- | ({{float_suffix}})
563+ | ({{float_suffix}})
550564 )
551- | \b{{dec_digits}}\.(?!\.)
552- | (\.)\d+
565+ | \b{{dec_digits}}\.(?!\.)
566+ | (\.)\d+
553567 )
554568 ({{bytes_unit}}\b)?
555569 )
@@ -599,50 +613,57 @@ contexts:
599613 captures :
600614 1 : punctuation.definition.variable.powershell
601615 - match : |-
602- (?x:(
603- (\$)
604- (?i:ExecutionContext|Host|Home|Is(?:CoreCLR|Linux|Windows|MacOS)
605- |PID|Profile|Ps(?:CommandPath|Home|ScriptRoot|UiCulture|VersionTable)
606- |ShellID)
616+ (?xi:
617+ (\$)
618+ (?:
619+ ExecutionContext | Host | Home | IsCoreCLR | IsLinux | IsWindows
620+ | IsMacOS | PID | Profile | PsCommandPath | PsHome | PsScriptRoot
621+ | PsUiCulture | PsVersionTable | ShellID
607622 )
608623 )
624+ scope: support.constant.variable.powershell
609625 captures:
610- 1: support.constant.variable.powershell
611- 2: punctuation.definition.variable.powershell
626+ 1: punctuation.definition.variable.powershell
612627 push: members
613628 - match : |-
614- (?x:(
615- (\$)
616- (?:
617- [$^?_]
618- |(?i:Args|ConsoleFileName|Error|Event|EventArgs|EventSubscriber
619- |ForEach|Input|LastExitCode|Matches|MyInvocation|NestedPromptLevel
620- |Ps(?:BoundParameters|Cmdlet|Culture|DebugContext|Item)|Pwd
621- |Sender|SourceArgs|SourceEventArgs|StackTrace|Switch|This)\b
622- )
629+ (?xi:
630+ (\$)
631+ (?:
632+ [$^?_]
633+ | (?:
634+ Args | ConsoleFileName | Error | Event | EventArgs
635+ | EventSubscriber | ForEach | Input | LastExitCode | Matches
636+ | MyInvocation | NestedPromptLevel | PsBoundParameters | PsCmdlet
637+ | PsCulture | PsDebugContext | PsItem | Pwd | Sender | SourceArgs
638+ | SourceEventArgs | StackTrace | Switch | This
639+ )\b
623640 )
624641 )
642+ scope: variable.language.powershell
625643 captures:
626- 1: variable.language.powershell
627- 2: punctuation.definition.variable.powershell
644+ 1: punctuation.definition.variable.powershell
628645 push: members
629646 - match : |-
630- (?x:(
647+ (?xi:
631648 (\$)
632- (?i:
633- (?:Confirm|Debug|ErrorAction|Information|Progress|Verbose|Warning # *Preference
634- |WhatIf)Preference
635- |Maximum(?:Alias|Drive|Error|Function|History|Variable)Count # Maximum*Count
636- |Log(?:Command|Engine|Provider)(?:Health|Lifecycle)Event # Log*Event
637- |Ps(?:DebugContext|DefaultParameterValues|EmailServer # Ps*
638- |ModuleAutoloadingPreference|SenderInfo|SessionApplicationName
639- |SessionConfigurationName|SessionOption)
640- |ErrorView|FormatEnumerationLimit|OFS|OutputEncoding)
649+ (?:
650+ (?:
651+ Confirm | Debug | ErrorAction | Information | Progress | Verbose # *Preference
652+ | Warning | WhatIf
653+ )
654+ Preference
655+ | Maximum(?:Alias|Drive|Error|Function|History|Variable)Count # Maximum*Count
656+ | Log(?:Command|Engine|Provider)(?:Health|Lifecycle)Event # Log*Event
657+ | PsDebugContext | PsDefaultParameterValues | PsEmailServer
658+ | PsModuleAutoloadingPreference | PsSenderInfo
659+ | PsSessionApplicationName | PsSessionConfigurationName
660+ | PsSessionOption | ErrorView | FormatEnumerationLimit | OFS
661+ | OutputEncoding
641662 )
642663 )
664+ scope: variable.language.powershell
643665 captures:
644- 1: variable.language.powershell
645- 2: punctuation.definition.variable.powershell
666+ 1: punctuation.definition.variable.powershell
646667 push: members
647668 - match : ((\$|@)(?i:(global|local|private|script|using|workflow):\w+))
648669 captures :
@@ -680,43 +701,52 @@ contexts:
680701 captures :
681702 1 : punctuation.definition.variable.powershell
682703 - match : |-
683- (?x :
704+ (?xi :
684705 (\$)
685- (?i:ExecutionContext|Host|Home|Is(?:CoreCLR|Linux|Windows|MacOS)
686- |PID|Profile|Ps(?:CommandPath|Home|ScriptRoot|UiCulture|VersionTable)
687- |ShellID
688- )\b
706+ (?:
707+ ExecutionContext | Host | Home | IsCoreCLR | IsLinux | IsWindows
708+ | IsMacOS | PID | Profile | PsCommandPath | PsHome | PsScriptRoot
709+ | PsUiCulture | PsVersionTable | ShellID
710+ )
689711 )
690712 scope: support.constant.variable.powershell
691713 captures:
692714 1: punctuation.definition.variable.powershell
693715 - match : |-
694- (?x :
716+ (?xi :
695717 (\$)
696718 (?:
697719 [$^?_]
698- |(?i:Args|ConsoleFileName|Error|Event|EventArgs|EventSubscriber
699- |ForEach|Input|LastExitCode|Matches|MyInvocation|NestedPromptLevel
700- |Ps(?:BoundParameters|Cmdlet|Culture|DebugContext|Item)|Pwd
701- |Sender|SourceArgs|SourceEventArgs|StackTrace|Switch|This)\b
720+ | (?:
721+ Args | ConsoleFileName | Error | Event | EventArgs
722+ | EventSubscriber | ForEach | Input | LastExitCode | Matches
723+ | MyInvocation | NestedPromptLevel | PsBoundParameters | PsCmdlet
724+ | PsCulture | PsDebugContext | PsItem | Pwd | Sender | SourceArgs
725+ | SourceEventArgs | StackTrace | Switch | This
726+ )\b
702727 )
703728 )
704729 scope: variable.language.powershell
705730 captures:
706731 1: punctuation.definition.variable.powershell
707732 - match : |-
708- (?x :
733+ (?xi :
709734 (\$)
710- (?i:
711- (?:Confirm|Debug|ErrorAction|Information|Progress|Verbose|Warning # *Preference
712- |WhatIf)Preference
713- |Maximum(?:Alias|Drive|Error|Function|History|Variable)Count # Maximum*Count
714- |Log(?:Command|Engine|Provider)(?:Health|Lifecycle)Event # Log*Event
715- |Ps(?:DebugContext|DefaultParameterValues|EmailServer # Ps*
716- |ModuleAutoloadingPreference|SenderInfo|SessionApplicationName
717- |SessionConfigurationName|SessionOption)
718- |ErrorView|FormatEnumerationLimit|OFS|OutputEncoding)
719- )\b
735+ (?:
736+ (?:
737+ Confirm | Debug | ErrorAction | Information | Progress | Verbose # *Preference
738+ | Warning | WhatIf
739+ )
740+ Preference
741+ | Maximum(?:Alias|Drive|Error|Function|History|Variable)Count # Maximum*Count
742+ | Log(?:Command|Engine|Provider)(?:Health|Lifecycle)Event # Log*Event
743+ | PsDebugContext | PsDefaultParameterValues | PsEmailServer
744+ | PsModuleAutoloadingPreference | PsSenderInfo
745+ | PsSessionApplicationName | PsSessionConfigurationName
746+ | PsSessionOption | ErrorView | FormatEnumerationLimit | OFS
747+ | OutputEncoding
748+ )
749+ )
720750 scope: variable.language.powershell
721751 captures:
722752 1: punctuation.definition.variable.powershell
0 commit comments