Skip to content

Commit 881aae7

Browse files
committed
Restrict workflow execution contexts to functions
1 parent e014fc7 commit 881aae7

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

PowerShell.sublime-syntax

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ contexts:
135135
scope: keyword.declaration.variable.powershell
136136

137137
# Uncategorized keywords
138-
- match: \b(?i:data|default|define|from|in|inlinescript|parallel|sequence){{kebab_break}}
138+
- match: \b(?i:default|in){{kebab_break}}
139139
scope: keyword.control.powershell
140140

141141
# Make everything afterward a literal
@@ -399,6 +399,7 @@ contexts:
399399
push: expect-function-context
400400

401401
- include: attributes
402+
- include: workflow-execution-contexts
402403
- include: statements
403404

404405
expect-function-context:
@@ -411,6 +412,7 @@ contexts:
411412
- match: \}
412413
scope: punctuation.section.block.end.powershell
413414
pop: 1
415+
- include: workflow-execution-contexts
414416
- include: statements
415417

416418
expect-param-context:
@@ -428,6 +430,12 @@ contexts:
428430
- include: types
429431
- include: variables-without-members
430432

433+
workflow-execution-contexts:
434+
- match: \b(?i:inlinescript){{kebab_break}}
435+
scope: keyword.control.context.powershell
436+
- match: \b(?i:parallel|sequence){{kebab_break}}
437+
scope: keyword.control.flow.powershell
438+
431439
attributes:
432440
- match: (\[)\s*({{attributes}})
433441
captures:

Tests/syntax_test_PowerShell.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1661,7 +1661,7 @@ Workflow work { sequence {} }
16611661
# ^^^^ entity.name.function.powershell
16621662
# @@@@ definition
16631663
# ^ punctuation.section.block.begin.powershell
1664-
# ^^^^^^^^ keyword.control.powershell
1664+
# ^^^^^^^^ keyword.control.flow.powershell
16651665
# ^^ meta.block.powershell
16661666
# ^ punctuation.section.braces.begin.powershell
16671667
# ^ punctuation.section.braces.end.powershell

0 commit comments

Comments
 (0)