ViewFilter Class
This class handles various editing and IntelliSense commands for a language service.
This API is not CLS-compliant.
Inheritance Hierarchy
System.Object
Microsoft.VisualStudio.Package.ViewFilter
Namespace: Microsoft.VisualStudio.Package
Assemblies: Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
Syntax
'Declaración
<CLSCompliantAttribute(False)> _
<ComVisibleAttribute(True)> _
Public Class ViewFilter _
Implements IVsTextViewFilter, IVsTextViewEvents, IOleCommandTarget, IDisposable, _
IVsExpansionEvents
[CLSCompliantAttribute(false)]
[ComVisibleAttribute(true)]
public class ViewFilter : IVsTextViewFilter, IVsTextViewEvents,
IOleCommandTarget, IDisposable, IVsExpansionEvents
The ViewFilter type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ViewFilter | Initializes a new instance of the ViewFilter class. |
Top
Properties
Name | Description | |
---|---|---|
CodeWindowManager | Gets the CodeWindowManager that owns this ViewFilter. | |
IsExecutingCommand | ||
IsExpansionUIActive | Determines if the code snippet expansion user interface (UI) is active. | |
SnippetBound | Gets or sets whether or not a key has been bound to the Invoke Snippet From Shortcut command. | |
Source | Gets the Source associated with this ViewFilter. | |
TextTipData | Gets or sets the TextTipData associated with this view. | |
TextView | Gets the IVsTextView object associated with this ViewFilter object. |
Top
Methods
Name | Description | |
---|---|---|
CanReformat | Determines whether the source can be reformatted by the language service. | |
Close | Closes down the view filter, releasing any allocated resources. | |
CommentSelection | Handles the COMMENT_BLOCK command to comment out the current selection in the view. | |
CreateTextTipData | Creates a new instance of the TextTipData class. | |
Dispose | Frees up any resources allocated when the ViewFilter class was created. | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
ExecCommand | Executes the specified command. | |
Finalize | Performs final clean up just before the ViewFilter object is destroyed. (Overrides Object.Finalize().) | |
GetDataTipText | Returns text about the given span that can be shown in a tool tip. | |
GetExpansionProvider | Returns an ExpansionProvider object. | |
GetFullDataTipText | Returns a string that can be used in a tool tip, taking into account additional sources of text such as a debugger. | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetPairExtents | Returns the extent of the innermost matching pair of language elements that contains the given location. | |
GetSelection | Returns the extent of the currently selected text. | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GetWordExtent | Returns the extent of the word or expression that contains the given location. | |
HandleGoto | Processes the specified "go to" command. | |
HandlePostExec | Handles post-processing after a command has been executed. | |
HandlePreExec | Handles pre-processing before a command is executed. | |
HandleQuickInfo | Handles the QUICKINFO command to show tool tip information about the selected identifier or expression. | |
HandleSmartIndent | Handles smart indentation. | |
InnerExec | Executes an IOleCommandTarget command. | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
OnAfterSnippetsKeyBindingChange | Called after there has been a change in the key binding for the Invoke Snippet From Shortcut command. | |
OnAfterSnippetsUpdate | Called whenever a folder that contains snippets has been updated and the snippets from that folder have been read in. | |
OnAutoComplete | Called when the AUTOCOMPLETE command is received. | |
OnChangeCaretLine | Called when the caret moves to another line. | |
OnChangeScrollInfo | Called when the scroll information for the specified scroll bar has changed. | |
OnKillFocus | Called when the specified view loses focus. | |
OnSetBuffer | Called when the buffer of lines is being set or changed in the given view. | |
OnSetFocus | Called when the specified view gains focus. | |
QueryCommandStatus | Determines if the specified command is supported. | |
QueryParameterList | Called to obtain the parameter for the specified command. | |
ReformatDocument | Handles the FORMATDOCUMENT command to reformat the entire document. | |
ReformatSelection | Handles the FORMATSELECTION command to reformat a selection. | |
RegisterExpansionManagerEventHandlers | ||
RegisterTextViewEventHandlers | ||
ShowContextMenu(Int32, Guid, IOleCommandTarget) | Handles the SHOWCONTEXTMENU command to show a context menu. | |
ShowContextMenu(Int32, Guid, IOleCommandTarget, Int32, Int32) | ||
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
TypeChar | Executes a TYPECHAR on the current command target chain. | |
UncommentSelection | Handles the UNCOMMENTBLOCK command to uncomment the current selection in the current view. |
Top
Explicit Interface Implementations
Name | Description | |
---|---|---|
IOleCommandTarget.Exec | Handles execution of a supported command. | |
IOleCommandTarget.QueryStatus | Determines if the specified commands in the given command group are supported. |
Top
Remarks
In addition to the cursor, Enter, Backspace, and Delete key commands, this base class provides support for the following commands:
Command |
Description |
---|---|
IntelliSense: select member from member list. |
|
IntelliSense: show member list. |
|
IntelliSense: complete word being typed. |
|
IntelliSense: show parameter information. |
|
IntelliSense: show information about an identifier. |
|
Editing (advanced): go to definition. |
|
Editing (advanced): go to declaration. |
|
Editing (advanced): go to a reference. |
|
Editing (advanced): comment a span of code. |
|
Editing (Advanced): uncomment a span of code. |
|
Editing (outlining): stop outlining. |
|
Editing (outlining): toggle outlining. |
|
Editing: show a context menu. |
Notes to Implementers
This class already implements all of the support for IntelliSense as well as various advanced editing features. However, if you want to support additional commands in your language service, then you must derive a class from this class and override the appropriate methods:
QueryCommandStatus (to indicate support for your commands)
QueryParameterList (if your commands require parameters)
HandlePreExec (if your commands require some set up)
HandlePostExec (if your commands require clean up after execution).
ExecCommand (to execute the command).
In addition, you must override the CreateViewFilter method in the LanguageService class to create an instance of your version of the ViewFilter class.
Notes to Callers
This class is instantiated in the CreateViewFilter method of the LanguageService class that is in turn called from the OnNewView method in the CodeWindowManager class when a view is attached to a source file.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.