Skip to content

Commit b0f864a

Browse files
committed
fix #136,
optimize single line comment use \G in and optimize commentEmbeddedDocs matches
1 parent 44eac87 commit b0f864a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

PowerShellSyntax.tmLanguage

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,10 @@
388388
<key>commentLine</key>
389389
<dict>
390390
<key>begin</key>
391-
<string>(?&lt;![`\\-])#</string>
391+
<string>(?&lt;![`\\-])(#)#*</string>
392392
<key>captures</key>
393393
<dict>
394-
<key>0</key>
394+
<key>1</key>
395395
<dict>
396396
<key>name</key>
397397
<string>punctuation.definition.comment.powershell</string>
@@ -556,8 +556,10 @@
556556
<string>keyword.operator.documentation.powershell</string>
557557
</dict>
558558
</dict>
559+
<key>comment</key>
560+
<string>these embedded doc keywords do not support arguments, must be the only thing on the line</string>
559561
<key>match</key>
560-
<string>^(?i:(?:\s?|#)+(\.)(COMPONENT|DESCRIPTION|EXAMPLE|EXTERNALHELP|FORWARDHELPCATEGORY|FORWARDHELPTARGETNAME|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|REMOTEHELPRUNSPACE|ROLE|SYNOPSIS))</string>
562+
<string>(?:^|\G)(?i:\s*(\.)(COMPONENT|DESCRIPTION|EXAMPLE|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|ROLE|SYNOPSIS))\s*$</string>
561563
<key>name</key>
562564
<string>comment.documentation.embedded.powershell</string>
563565
</dict>
@@ -580,8 +582,10 @@
580582
<string>keyword.operator.documentation.powershell</string>
581583
</dict>
582584
</dict>
585+
<key>comment</key>
586+
<string>these embedded doc keywords require arguments though the type required may be inconsistent, they may not all be able to use the same argument match</string>
583587
<key>match</key>
584-
<string>(?i:\s?(\.)(PARAMETER|FORWARDHELPTARGETNAME|FORWARDHELPCATEGORY|REMOTEHELPRUNSPACE|EXTERNALHELP)\s+([a-z0-9-_]+))</string>
588+
<string>(?:^|\G)(?i:\s*(\.)(EXTERNALHELP|FORWARDHELP(?:CATEGORY|TARGETNAME)|PARAMETER|REMOTEHELPRUNSPACE))\s+(.+?)\s*$</string>
585589
<key>name</key>
586590
<string>comment.documentation.embedded.powershell</string>
587591
</dict>

0 commit comments

Comments
 (0)