@@ -10,9 +10,10 @@ file_extensions:
10
10
- psd1
11
11
12
12
first_line_match : |
13
- (?x)
13
+ (?x:
14
14
^\#!.*\b(?:pwsh|powershell)\b
15
15
| ^\# \s* -\*- [^*]* mode: \s* powershell [^*]* -\*-
16
+ )
16
17
17
18
variables :
18
19
dec_digits : (?:[\d_]*\d)
@@ -252,9 +253,13 @@ contexts:
252
253
- match : |-
253
254
(?xi:
254
255
(\[)\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 ))
258
263
)\b
259
264
)
260
265
captures:
@@ -282,10 +287,12 @@ contexts:
282
287
- include: main
283
288
- match: |-
284
289
(?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
+ )
289
296
\s*(=)
290
297
)
291
298
captures:
@@ -306,17 +313,21 @@ contexts:
306
313
- match : |-
307
314
(?x:
308
315
(?:[\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
320
331
)
321
332
\-\w+? # Any "noun"
322
333
(?:\.(?i:exe|cmd|bat|ps1))?\b # More path stuff
@@ -342,8 +353,11 @@ contexts:
342
353
- match : |-
343
354
(?xi:
344
355
^\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
+ )
347
361
)
348
362
scope: comment.documentation.embedded.powershell
349
363
captures:
@@ -542,14 +556,14 @@ contexts:
542
556
(?:
543
557
(?:
544
558
(?:(\.(?!\.))\d*) # No `_` after the `.`
545
- {{dec_exponent}}?
546
- | {{dec_exponent}}
559
+ {{dec_exponent}}?
560
+ | {{dec_exponent}}
547
561
)
548
562
({{float_suffix}})?
549
- | ({{float_suffix}})
563
+ | ({{float_suffix}})
550
564
)
551
- | \b{{dec_digits}}\.(?!\.)
552
- | (\.)\d+
565
+ | \b{{dec_digits}}\.(?!\.)
566
+ | (\.)\d+
553
567
)
554
568
({{bytes_unit}}\b)?
555
569
)
@@ -599,50 +613,57 @@ contexts:
599
613
captures :
600
614
1 : punctuation.definition.variable.powershell
601
615
- 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
607
622
)
608
623
)
624
+ scope: support.constant.variable.powershell
609
625
captures:
610
- 1: support.constant.variable.powershell
611
- 2: punctuation.definition.variable.powershell
626
+ 1: punctuation.definition.variable.powershell
612
627
push: members
613
628
- 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
623
640
)
624
641
)
642
+ scope: variable.language.powershell
625
643
captures:
626
- 1: variable.language.powershell
627
- 2: punctuation.definition.variable.powershell
644
+ 1: punctuation.definition.variable.powershell
628
645
push: members
629
646
- match : |-
630
- (?x:(
647
+ (?xi:
631
648
(\$)
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
641
662
)
642
663
)
664
+ scope: variable.language.powershell
643
665
captures:
644
- 1: variable.language.powershell
645
- 2: punctuation.definition.variable.powershell
666
+ 1: punctuation.definition.variable.powershell
646
667
push: members
647
668
- match : ((\$|@)(?i:(global|local|private|script|using|workflow):\w+))
648
669
captures :
@@ -680,43 +701,52 @@ contexts:
680
701
captures :
681
702
1 : punctuation.definition.variable.powershell
682
703
- match : |-
683
- (?x :
704
+ (?xi :
684
705
(\$)
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
+ )
689
711
)
690
712
scope: support.constant.variable.powershell
691
713
captures:
692
714
1: punctuation.definition.variable.powershell
693
715
- match : |-
694
- (?x :
716
+ (?xi :
695
717
(\$)
696
718
(?:
697
719
[$^?_]
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
702
727
)
703
728
)
704
729
scope: variable.language.powershell
705
730
captures:
706
731
1: punctuation.definition.variable.powershell
707
732
- match : |-
708
- (?x :
733
+ (?xi :
709
734
(\$)
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
+ )
720
750
scope: variable.language.powershell
721
751
captures:
722
752
1: punctuation.definition.variable.powershell
0 commit comments