Click or drag to resize
FormatCommenter.CommentSpan Method
Comment out the code in a single VirtualSnapshotSpan.

Namespace: Tvl.VisualStudio.Text.Commenter
Assembly: Tvl.VisualStudio.Commenter.Utility.10 (in Tvl.VisualStudio.Commenter.Utility.10.dll) Version: 1.0.0.0
Syntax
protected virtual VirtualSnapshotSpan CommentSpan(
	VirtualSnapshotSpan span,
	ITextEdit edit
)

Parameters

span
Type: Microsoft.VisualStudio.Text.VirtualSnapshotSpan
The span of text to comment.
edit
Type: Microsoft.VisualStudio.Text.ITextEdit
The ITextEdit to apply the changes to.

Return Value

Type: VirtualSnapshotSpan
A VirtualSnapshotSpan containing the commented code.
Remarks

The default implementation uses line comments if UseLineComments is true and one of the following is true.

  1. There is no selected text.
  2. On the line where the selection starts, there is only whitespace up to the selection start point, and one of the following is true.
    • On the line where the selection ends, there is only whitespace up to the selection end point, or
    • There is only whitespace from the selection end point to the end of the line.

The default implementation uses block comments if all of the following are true.

  • We are not using line comments.
  • PreferredBlockFormat is not null.
See Also