Skip to content

Commit b062be9

Browse files
committed
1 parent 874633b commit b062be9

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

Support/PowershellSyntax.tmLanguage

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,27 @@
237237
</dict>
238238
<dict>
239239
<key>match</key>
240-
<string>(?&lt;!\w)((?i:begin|break|catch|class|continue|data|define|do|dynamicparam|else|elseif|end|exit|filter|finally|for|foreach(?!-object)|from|if|in|inlinescript|parallel|param|process|return|switch|throw|trap|try|until|using|var|where(?!=-object)|while|workflow)|%|\?)(?!\w)</string>
240+
<string>(?&lt;!\w)((?i:begin|break|catch|continue|data|define|do|dynamicparam|else|elseif|end|exit|filter|finally|for|foreach(?!-object)|from|if|in|inlinescript|parallel|param|process|return|switch|throw|trap|try|until|using|var|where(?!=-object)|while)|%|\?)(?!\w)</string>
241241
<key>name</key>
242242
<string>keyword.control.powershell</string>
243243
</dict>
244+
<dict>
245+
<key>captures</key>
246+
<dict>
247+
<key>1</key>
248+
<dict>
249+
<key>name</key>
250+
<string>storage.type.powershell</string>
251+
</dict>
252+
<key>2</key>
253+
<dict>
254+
<key>name</key>
255+
<string>entity.name.function</string>
256+
</dict>
257+
</dict>
258+
<key>match</key>
259+
<string>(?&lt;!\w)((?i:class|workflow)|%|\?)(?:\s)+(\w+)\b</string>
260+
</dict>
244261
<dict>
245262
<key>match</key>
246263
<string>(?&lt;!\w)-(?i:is(?:not)?|as)\b</string>
@@ -494,7 +511,7 @@
494511
<key>function</key>
495512
<dict>
496513
<key>begin</key>
497-
<string>(?i:function|configuration)\s+((?:\p{L}|\d|_|-)+)</string>
514+
<string>((?i:function|configuration))\s+((?:\p{L}|\d|_|-)+)</string>
498515
<key>beginCaptures</key>
499516
<dict>
500517
<key>0</key>

tests/samples/test-file.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ function echo([string]$text) {
5959
write-host $text
6060
}
6161

62+
# declaration should be consistent
63+
function foo() {}
64+
Function foo() {}
65+
66+
class A {}
67+
Class Foo {}
68+
69+
workflow w1 {}
70+
Workflow work {}
71+
72+
configuration c {}
73+
Configuration c {}
6274

6375
# Highlight types
6476
[int[]][char[]]"hello world"

0 commit comments

Comments
 (0)