Skip to content

Commit cf27d6e

Browse files
msftrncsTylerLeonhardt
authored andcommitted
Fixes @splatting in double quoted strings (#165)
* fixes #149, #164 remove #variable from #doubleQuotedString, remove @ from #variableNoProperty * add tests: no @splats in double quoted strings
1 parent 12b7d72 commit cf27d6e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

PowerShellSyntax.tmLanguage

+1-5
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,7 @@
13931393
</dict>
13941394
</dict>
13951395
<key>match</key>
1396-
<string>(?i:(\$|@)(global|local|private|script|using|workflow):((?:\p{L}|\d|_)+))</string>
1396+
<string>(?i:(\$)(global|local|private|script|using|workflow):((?:\p{L}|\d|_)+))</string>
13971397
</dict>
13981398
<dict>
13991399
<key>captures</key>
@@ -1592,10 +1592,6 @@
15921592
<key>include</key>
15931593
<string>#variableNoProperty</string>
15941594
</dict>
1595-
<dict>
1596-
<key>include</key>
1597-
<string>#variable</string>
1598-
</dict>
15991595
<dict>
16001596
<key>include</key>
16011597
<string>#doubleQuotedStringEscapes</string>

spec/testfiles/syntax_test_TheBigTestFile.ps1

+9
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@ $variable.Name
173173
# ^^^^^^^^^^^^ variable.other.readwrite.powershell
174174
# ^ punctuation.definition.string.end.powershell
175175

176+
# @splat references only work in argument mode, should not highlight in strings
177+
"This is a @double quoted string."
178+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.powershell
179+
# ^ not:punctuation.definition.variable.powershell
180+
# ^ not:variable.other.readwrite.powershell
181+
176182
# Single quotes string
177183
'This is a string'
178184
# <- punctuation.definition.string.begin.powershell string.quoted.single.powershell
@@ -369,6 +375,9 @@ $This is a 'double quoted'
369375
# <- punctuation.definition.variable.powershell
370376
# ^ string.quoted.double.heredoc.powershell support.variable.automatic.powershell
371377
Isn't it "nice"??
378+
There is no @platting here!
379+
# ^ not:punctuation.definition.variable.powershell
380+
# ^ not:variable.other.readwrite.powershell
372381
"@
373382
# <- string.quoted.double.heredoc.powershell
374383
# <- string.quoted.double.heredoc.powershell

0 commit comments

Comments
 (0)