Skip to content

Commit 2fb86c4

Browse files
Merge pull request #175 from msftrncs/Issue136_FixDocKeywords
Improvements to Comment Based Help Keywords
2 parents c784ca4 + b0f864a commit 2fb86c4

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
@@ -413,10 +413,10 @@
413413
<key>commentLine</key>
414414
<dict>
415415
<key>begin</key>
416-
<string>(?&lt;![`\\-])#</string>
416+
<string>(?&lt;![`\\-])(#)#*</string>
417417
<key>captures</key>
418418
<dict>
419-
<key>0</key>
419+
<key>1</key>
420420
<dict>
421421
<key>name</key>
422422
<string>punctuation.definition.comment.powershell</string>
@@ -581,8 +581,10 @@
581581
<string>keyword.operator.documentation.powershell</string>
582582
</dict>
583583
</dict>
584+
<key>comment</key>
585+
<string>these embedded doc keywords do not support arguments, must be the only thing on the line</string>
584586
<key>match</key>
585-
<string>^(?i:(?:\s?|#)+(\.)(COMPONENT|DESCRIPTION|EXAMPLE|EXTERNALHELP|FORWARDHELPCATEGORY|FORWARDHELPTARGETNAME|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|REMOTEHELPRUNSPACE|ROLE|SYNOPSIS))</string>
587+
<string>(?:^|\G)(?i:\s*(\.)(COMPONENT|DESCRIPTION|EXAMPLE|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|ROLE|SYNOPSIS))\s*$</string>
586588
<key>name</key>
587589
<string>comment.documentation.embedded.powershell</string>
588590
</dict>
@@ -605,8 +607,10 @@
605607
<string>keyword.operator.documentation.powershell</string>
606608
</dict>
607609
</dict>
610+
<key>comment</key>
611+
<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>
608612
<key>match</key>
609-
<string>(?i:\s?(\.)(PARAMETER|FORWARDHELPTARGETNAME|FORWARDHELPCATEGORY|REMOTEHELPRUNSPACE|EXTERNALHELP)\s+([a-z0-9-_]+))</string>
613+
<string>(?:^|\G)(?i:\s*(\.)(EXTERNALHELP|FORWARDHELP(?:CATEGORY|TARGETNAME)|PARAMETER|REMOTEHELPRUNSPACE))\s+(.+?)\s*$</string>
610614
<key>name</key>
611615
<string>comment.documentation.embedded.powershell</string>
612616
</dict>

0 commit comments

Comments
 (0)