Skip to content

Commit d20ddfc

Browse files
committed
Add supplemental scopes to some documentation
1 parent 46cfcfd commit d20ddfc

File tree

2 files changed

+42
-15
lines changed

2 files changed

+42
-15
lines changed

PowerShell.sublime-syntax

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -806,33 +806,30 @@ contexts:
806806
- include: comment-embedded-docs
807807

808808
comment-embedded-docs:
809-
# TODO
810809
# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help
811-
- match: |-
812-
(?xi:
813-
^\s*(\.)
814-
(
815-
Component | Description | Example | ExternalHelp | ForwardHelpCategory | ForwardHelpTargetName
816-
| Functionality | Inputs | Link | Notes | Outputs | Parameter | RemoteHelpRunSpace
817-
| Role | Synopsis
818-
)
819-
)
820-
scope: comment.documentation.embedded.powershell
821-
captures:
822-
1: punctuation.definition.keyword.documentation.powershell
823-
2: keyword.other.documentation.powershell
824810
- match: ^\s*(\.)(?i:(Parameter)\s+([a-z0-9-_]+))
825811
scope: comment.documentation.embedded.powershell
826812
captures:
827813
1: punctuation.definition.keyword.documentation.powershell
828814
2: keyword.other.documentation.param.powershell
829815
3: variable.parameter.powershell
830-
- match: ^\s*(\.)(?i:(ForwardHelpTargetName|ForwardHelpCategory|ExternalHelp|Link)\s+([a-z0-9-_]+))
816+
- match: ^\s*(\.)(?i:(ForwardHelpTargetName|ExternalHelp|Link)\s+([a-z0-9-_:/.&]+))
831817
scope: comment.documentation.embedded.powershell
832818
captures:
833819
1: punctuation.definition.keyword.documentation.powershell
834820
2: keyword.other.documentation.powershell
835821
3: markup.underline.link.powershell
822+
- match: ^\s*(\.)(?i:(ForwardHelpCategory)\s+({{doc_fwdhelp_cat}}))
823+
scope: comment.documentation.embedded.powershell
824+
captures:
825+
1: punctuation.definition.keyword.documentation.powershell
826+
2: keyword.other.documentation.powershell
827+
3: support.type.powershell
828+
- match: ^\s*(\.)({{doc}})
829+
scope: comment.documentation.embedded.powershell
830+
captures:
831+
1: punctuation.definition.keyword.documentation.powershell
832+
2: keyword.other.documentation.powershell
836833

837834
comment-line:
838835
- match: '#(?!(?i:requires|(?:end)?region)\b)'
@@ -961,3 +958,16 @@ variables:
961958
# Other verbs
962959
| Use
963960
)\b
961+
962+
# Documentation
963+
doc: |-
964+
(?xi:
965+
Component | Description | Example | ExternalHelp | ForwardHelpCategory
966+
| ForwardHelpTargetName | Functionality | Inputs | Link | Notes | Outputs
967+
| Parameter | RemoteHelpRunSpace | Role | Synopsis
968+
)
969+
doc_fwdhelp_cat: |-
970+
(?x:
971+
Alias | Cmdlet | HelpFile | Function | Provider | General | FAQ
972+
| Glossary | ScriptCommand | ExternalScript | Filter | All
973+
)

Tests/syntax_test_Function.ps1

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,23 @@ function Test-Path {}
5151
# <- punctuation.definition.keyword
5252
# ^ keyword.other.documentation
5353
The functionality that best describes this cmdlet
54+
.ForwardHelpCategory Alias
55+
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.powershell comment.documentation.embedded.powershell
56+
# ^ punctuation.definition.keyword.documentation.powershell
57+
# ^^^^^^^^^^^^^^^^^^^ keyword.other.documentation.powershell
58+
# ^^^^^ support.type.powershell
59+
60+
.parameter foo
61+
#^^^^^^^^^^^^^^^^^ comment.block.powershell comment.documentation.embedded.powershell
62+
# ^ punctuation.definition.keyword.documentation.powershell
63+
# ^^^^^^^^^ keyword.other.documentation.param.powershell
64+
# ^^^ variable.parameter.powershell
65+
66+
.LINK https://example.com
67+
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.powershell comment.documentation.embedded.powershell
68+
# ^ punctuation.definition.keyword.documentation.powershell
69+
# ^^^^ keyword.other.documentation.powershell
70+
# ^^^^^^^^^^^^^^^^^^^ markup.underline.link.powershell
5471
5572
This should not be considered documentaton -> .role
5673
# ^ - keyword.operator.documentation

0 commit comments

Comments
 (0)