-
Notifications
You must be signed in to change notification settings - Fork 45
Comment
Line comments are comments that start with the hash-character (#
) and ends with a line-break (EOL).
# This is a line comment
Write-Host 'Hello World!' #This is also a line comment!
The following scopes are assigned to line comments:
- punctuation.definition.comment
- comment.line
The hash-character is given the punctuation.definition.comment scope, while the comment itself are given the comment.line scope.
Block comments start with <#
and ends with #>
. Everything between these two markers are considered a comment.
<#
This is a block comment.
#>
The following scopes are assigned to block comments:
- punctuation.definition.comment
- comment.block
<#
and #>
are assigned the punctuation.definition.comment scope, and everything inbetween is given the comment.block scope.
Within any comment scope, syntax highlighting rules exist for PowerShell comment-based help.
<#
.Description
Get-Function displays the name and syntax of all functions in the session.
#>
The following scopes are assigned to comment-based help:
- keyword.operator.documentation
- comment.block.documentation
- constant.string.documentation
The keywords (.Description
the above example) are given the scope of keyword.operator.documentation, while normal strings after the keyword (if on the same line) gets the constant.string.documentation scope. comment.block.documentation is a meta scope given to the whole line.
Use
- Prerequisites
- Workflow
- Tests
- Comment
- String
- Numeric constant
- Type
- Function
- Command (Cmdlet)
- Class
- Enum
- Switch
- Array
- Hashtable
- Subexpression
- Control
- Variable
- Operator