Skip to content

Commit 7c039e0

Browse files
committed
Duplicated variable highlighting, but removed property matching for use in double-quoted strings.
1 parent f9292e6 commit 7c039e0

File tree

1 file changed

+117
-2
lines changed

1 file changed

+117
-2
lines changed

PowerShellSyntax.tmLanguage

Lines changed: 117 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@
11161116
</dict>
11171117
<dict>
11181118
<key>include</key>
1119-
<string>#variable</string>
1119+
<string>#variableWithoutPropertyHighlighting</string>
11201120
</dict>
11211121
<dict>
11221122
<key>include</key>
@@ -1140,7 +1140,7 @@
11401140
</dict>
11411141
<dict>
11421142
<key>include</key>
1143-
<string>#variable</string>
1143+
<string>#variableWithoutPropertyHighlighting</string>
11441144
</dict>
11451145
<dict>
11461146
<key>include</key>
@@ -1515,6 +1515,121 @@
15151515
</dict>
15161516
</array>
15171517
</dict>
1518+
<key>variableWithoutPropertyHighlighting</key>
1519+
<dict>
1520+
<key>patterns</key>
1521+
<array>
1522+
<dict>
1523+
<key>comment</key>
1524+
<string>Invalid variable name</string>
1525+
<key>match</key>
1526+
<string>(\$)(\w+-\w+)\b</string>
1527+
<key>name</key>
1528+
<string>invalid.illegal.powershell</string>
1529+
</dict>
1530+
<dict>
1531+
<key>captures</key>
1532+
<dict>
1533+
<key>1</key>
1534+
<dict>
1535+
<key>name</key>
1536+
<string>constant.language.powershell</string>
1537+
</dict>
1538+
<key>2</key>
1539+
<dict>
1540+
<key>name</key>
1541+
<string>constant.language.powershell</string>
1542+
</dict>
1543+
</dict>
1544+
<key>comment</key>
1545+
<string>Automatic variables - read-only.</string>
1546+
<key>match</key>
1547+
<string>(\$)(?i:(_|args|consolefilename|error|event|eventsubscriber|executioncontext|false|foreach|home|host|input|lastexitcode|matches|myinvocation|nestedpromptlevel|null|pid|psboundparameters|pscmdlet|psculture|psdebugcontext|pshome|psitem|psscriptroot|psuiculture|psversiontable|pwd|sender|shellid|sourceargs|sourceeventargs|switch|this|true))\b</string>
1548+
</dict>
1549+
<dict>
1550+
<key>captures</key>
1551+
<dict>
1552+
<key>1</key>
1553+
<dict>
1554+
<key>name</key>
1555+
<string>keyword.other.powershell</string>
1556+
</dict>
1557+
<key>2</key>
1558+
<dict>
1559+
<key>name</key>
1560+
<string>storage.modifier.scope.powershell</string>
1561+
</dict>
1562+
<key>3</key>
1563+
<dict>
1564+
<key>name</key>
1565+
<string>variable.other.readwrite.powershell</string>
1566+
</dict>
1567+
<key>4</key>
1568+
<dict>
1569+
<key>name</key>
1570+
<string>variable.other.readwrite.powershell</string>
1571+
</dict>
1572+
</dict>
1573+
<key>comment</key>
1574+
<string>$var, $local:var</string>
1575+
<key>match</key>
1576+
<string>(\$)((?i:global|local|script|private|using|env|function|alias|cert|variable|hkcu|hklm|wsman):)?(\w+)(:\w+)?</string>
1577+
</dict>
1578+
<dict>
1579+
<key>captures</key>
1580+
<dict>
1581+
<key>1</key>
1582+
<dict>
1583+
<key>name</key>
1584+
<string>keyword.other.powershell</string>
1585+
</dict>
1586+
<key>2</key>
1587+
<dict>
1588+
<key>name</key>
1589+
<string>keyword.other.powershell</string>
1590+
</dict>
1591+
<key>3</key>
1592+
<dict>
1593+
<key>name</key>
1594+
<string>storage.modifier.scope.powershell</string>
1595+
</dict>
1596+
<key>4</key>
1597+
<dict>
1598+
<key>name</key>
1599+
<string>variable.other.readwrite.powershell</string>
1600+
</dict>
1601+
<key>5</key>
1602+
<dict>
1603+
<key>name</key>
1604+
<string>keyword.other.powershell</string>
1605+
</dict>
1606+
</dict>
1607+
<key>comment</key>
1608+
<string>${var}, ${script:var}</string>
1609+
<key>match</key>
1610+
<string>(\$)(\{)((?i:global|local|script|private|using|env|function|alias|cert|variable|hkcu|hklm|wsman):)?(.+)(\})</string>
1611+
</dict>
1612+
<dict>
1613+
<key>captures</key>
1614+
<dict>
1615+
<key>1</key>
1616+
<dict>
1617+
<key>name</key>
1618+
<string>keyword.other.powershell</string>
1619+
</dict>
1620+
<key>2</key>
1621+
<dict>
1622+
<key>name</key>
1623+
<string>variable.other.readwrite.powershell</string>
1624+
</dict>
1625+
</dict>
1626+
<key>comment</key>
1627+
<string>Splatting</string>
1628+
<key>match</key>
1629+
<string>(@)(\w+)</string>
1630+
</dict>
1631+
</array>
1632+
</dict>
15181633
</dict>
15191634
<key>scopeName</key>
15201635
<string>source.powershell</string>

0 commit comments

Comments
 (0)