Skip to content

Commit 82f5288

Browse files
committed
Rescope the source operator
1 parent d56121f commit 82f5288

File tree

2 files changed

+36
-28
lines changed

2 files changed

+36
-28
lines changed

PowerShell.sublime-syntax

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,22 @@ contexts:
4848
statements:
4949
- include: redirection
5050
- include: classes
51-
- include: expressions
5251
- include: functions
5352
- include: workflows
5453
- include: desired-state-configurations
5554

56-
- match: \B\.(?= )
57-
scope: support.function.source.powershell
58-
5955
- include: exceptions
6056
- include: loops
6157
- include: flow
6258
- include: conditionals
6359

60+
- match: \B\.(?= )
61+
scope: keyword.operator.source.powershell
62+
- match: \&
63+
scope: keyword.operator.call.powershell
64+
65+
- include: expressions
66+
6467
expressions:
6568
# Meta
6669
- include: labels

Tests/syntax_test_PowerShell.ps1

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ throw "Do not run this file!"
9191

9292
# Stop parsing
9393
& tool.exe /arg1 'value' /arg2 $value --% /arg3 $value /arg4 "value" # Comment
94-
# <- keyword.operator.background
94+
# <- keyword.operator.call
9595
# ^^^^^^^^ variable.function
9696
# ^ punctuation.definition.parameter
9797
# ^^^^^ variable.parameter.option
@@ -101,7 +101,7 @@ throw "Do not run this file!"
101101
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted - constant - variable - comment
102102

103103
& gnutool.exe -s 'short option' --long-option --very_long_option value +plus-option
104-
#<- keyword.operator.background
104+
#<- keyword.operator.call
105105
# ^^^^^^^^^^^ variable.function
106106
# ^ variable.parameter.option punctuation.definition.parameter
107107
# ^ variable.parameter.option
@@ -873,28 +873,33 @@ $a3[1..2]
873873
# ^ keyword.operator.logical.pipe
874874
# ^^^^^^^^^^^^^^^^ support.function
875875

876-
# Commands (Built-in variables)
877-
ls *.ps1 -recurse
878-
# ^ keyword.operator
879-
# ^ punctuation.definition.parameter
880-
# ^^^^^^^^ variable.parameter.option
881-
882-
# Commands (executable files)
883-
. .\scripts\Test-Foo.ps1 -parameter 'value'
884-
# ^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
885-
# @@@@@@@@@@@@@@@@@@@@@@ reference
886-
# ^^^^^^^^^^ variable.parameter.option.powershell
887-
# ^ punctuation.definition.parameter.powershell
888-
# ^^^^^^^ meta.string.powershell string.quoted.single.powershell
889-
# ^ punctuation.definition.string.begin.powershell
890-
# ^ punctuation.definition.string.end.powershell
891-
& tool.exe
892-
# <- keyword.operator.background
893-
# ^^^^^^^^ variable.function
894-
something.cmd
895-
#^^^^^^^^^^^^ variable.function
896-
øyvind.com
897-
#^^^^^^^^^^ variable.function
876+
# Commands (Built-in variables)
877+
ls *.ps1 -recurse
878+
# ^ keyword.operator.arithmetic.powershell
879+
# ^^^^^^^^ variable.parameter.option.powershell
880+
# ^ punctuation.definition.parameter.powershell
881+
882+
# Commands (executable files)
883+
. .\scripts\Test-Foo.ps1 -parameter 'value'
884+
# ^ keyword.operator.source.powershell
885+
# ^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
886+
# @@@@@@@@@@@@@@@@@@@@@@ reference
887+
# ^^^^^^^^^^ variable.parameter.option.powershell
888+
# ^ punctuation.definition.parameter.powershell
889+
# ^^^^^^^ meta.string.powershell string.quoted.single.powershell
890+
# ^ punctuation.definition.string.begin.powershell
891+
# ^ punctuation.definition.string.end.powershell
892+
893+
& tool.exe
894+
# ^ keyword.operator.call.powershell
895+
# ^^^^^^^^ variable.function.powershell
896+
897+
something.cmd
898+
# ^^^^^^^^^^^^^ variable.function.powershell
899+
900+
øyvind.com
901+
# ^^^^^^^^^^ variable.function.powershell
902+
898903

899904
# switch
900905
switch ("fourteen") {}

0 commit comments

Comments
 (0)