File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,11 +57,6 @@ contexts:
5757 - include : workflows
5858 - include : desired-state-configurations
5959
60- - include : exceptions
61- - include : loops
62- - include : flow
63- - include : conditionals
64-
6560 - match : \B\.(?= )
6661 scope : keyword.operator.source.powershell
6762 push :
@@ -86,6 +81,12 @@ contexts:
8681
8782 - include : escape-sequences
8883
84+ # Statements that may return values
85+ - include : exceptions
86+ - include : loops
87+ - include : flow
88+ - include : conditionals
89+
8990 # Normal code
9091 - include : types
9192 - include : strings
Original file line number Diff line number Diff line change @@ -281,6 +281,23 @@ using namespace System.Management.Automation
281281# ^ punctuation.section.arguments.begin.powershell
282282# ^ punctuation.section.arguments.end.powershell
283283
284+ # Statement value assignment
285+ $x = if ($a ) { 1 } else { 2 }
286+ # ^^ keyword.control.conditional
287+ # ^^^^ keyword.control.conditional
288+
289+ $x = switch ($v ) { 1 { ' one' } default { ' other' } }
290+ # ^^^^^^ keyword.control.conditional.switch
291+
292+ $x = foreach ($i in 1 .. 3 ) { $i * 2 }
293+ # ^^^^^^^ keyword.control.loop
294+
295+ $x = try { Get-Thing } catch { $null }
296+ # ^^^ keyword.control.exception
297+ # @@@@@@@@@ reference
298+ # ^^^^^ keyword.control.exception
299+
300+
284301# Hashtable
285302$properties = @ {
286303# <- punctuation.definition.variable
You can’t perform that action at this time.
0 commit comments