Udostępnij za pośrednictwem


ViewFilter.CommentSelection Method

Handles the COMMENT_BLOCK command to comment out the current selection in the view.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)

Syntax

'Declaration
Public Overridable Sub CommentSelection
public virtual void CommentSelection()
public:
virtual void CommentSelection()
abstract CommentSelection : unit -> unit 
override CommentSelection : unit -> unit 
public function CommentSelection()

Remarks

This method obtains the current selection from the view and calls the Source object to comment out the selection.

The base method obtains the current selection by calling the GetSelection method, then calls the CommentSpan method on the Source object, and finally calls the SetSelection method on the IVsTextView object passed to the ViewFilter class constructor to select the newly commented block.

In the default managed package framework implementation of the language service classes, this method is called from the HandlePreExec method.

.NET Framework Security

See Also

Reference

ViewFilter Class

Microsoft.VisualStudio.Package Namespace