Export (0) Print
Expand All

ViewFilter Class

This class handles various editing and IntelliSense commands for a language service.

This API is not CLS-compliant. 

System.Object
  Microsoft.VisualStudio.Package.ViewFilter

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.12.0 (in Microsoft.VisualStudio.Package.LanguageService.12.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)

[CLSCompliantAttribute(false)]
[ComVisibleAttribute(true)]
public class ViewFilter : IVsTextViewFilter, IVsTextViewEvents, 
	IOleCommandTarget, IDisposable, IVsExpansionEvents

The ViewFilter type exposes the following members.

  NameDescription
Public methodViewFilterInitializes a new instance of the ViewFilter class.
Top

  NameDescription
Public propertyCodeWindowManagerGets the CodeWindowManager that owns this ViewFilter.
Public propertyStatic memberIsExecutingCommandDetermines whether or not the filter is executing commands.
Public propertyIsExpansionUIActiveDetermines if the code snippet expansion user interface (UI) is active.
Protected propertySnippetBoundGets or sets whether or not a key has been bound to the Invoke Snippet From Shortcut command.
Public propertySourceGets the Source associated with this ViewFilter.
Public propertyTextTipDataGets or sets the TextTipData associated with this view.
Public propertyTextViewGets the IVsTextView object associated with this ViewFilter object.
Top

  NameDescription
Public methodCanReformatDetermines whether the source can be reformatted by the language service.
Public methodCloseCloses down the view filter, releasing any allocated resources.
Public methodCommentSelectionHandles the COMMENT_BLOCK command to comment out the current selection in the view.
Public methodCreateTextTipDataCreates a new instance of the TextTipData class.
Public methodDisposeFrees up any resources allocated when the ViewFilter class was created.
Public methodEqualsDetermines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodExecCommandExecutes the specified command.
Protected methodFinalizePerforms final clean up just before the ViewFilter object is destroyed. (Overrides Object.Finalize().)
Public methodGetDataTipTextReturns text about the given span that can be shown in a tool tip.
Public methodGetExpansionProviderReturns an ExpansionProvider object.
Public methodGetFullDataTipTextReturns a string that can be used in a tool tip, taking into account additional sources of text such as a debugger.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetPairExtentsReturns the extent of the innermost matching pair of language elements that contains the given location.
Public methodGetSelectionReturns the extent of the currently selected text.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetWordExtentReturns the extent of the word or expression that contains the given location.
Public methodHandleGotoProcesses the specified "go to" command.
Public methodHandlePostExecHandles post-processing after a command has been executed.
Public methodHandlePreExecHandles pre-processing before a command is executed.
Public methodHandleQuickInfoHandles the QUICKINFO command to show tool tip information about the selected identifier or expression.
Public methodHandleSmartIndentHandles smart indentation.
Protected methodInnerExecExecutes an IOleCommandTarget command.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodOnAfterSnippetsKeyBindingChangeCalled after there has been a change in the key binding for the Invoke Snippet From Shortcut command.
Public methodOnAfterSnippetsUpdateCalled whenever a folder that contains snippets has been updated and the snippets from that folder have been read in.
Public methodOnAutoCompleteCalled when the AUTOCOMPLETE command is received.
Public methodOnChangeCaretLineCalled when the caret moves to another line.
Public methodOnChangeScrollInfoCalled when the scroll information for the specified scroll bar has changed.
Public methodOnKillFocusCalled when the specified view loses focus.
Public methodOnSetBufferCalled when the buffer of lines is being set or changed in the given view.
Public methodOnSetFocusCalled when the specified view gains focus.
Protected methodQueryCommandStatusDetermines if the specified command is supported.
Protected methodQueryParameterListCalled to obtain the parameter for the specified command.
Public methodReformatDocumentHandles the FORMATDOCUMENT command to reformat the entire document.
Public methodReformatSelectionHandles the FORMATSELECTION command to reformat a selection.
Public methodRegisterExpansionManagerEventHandlersRegisters event handlers IVsExpansionEvents.
Public methodRegisterTextViewEventHandlersRegister text view event handlers.
Public methodShowContextMenu(Int32, Guid, IOleCommandTarget)
Public methodShowContextMenu(Int32, Guid, IOleCommandTarget, Int32, Int32)Handles the SHOWCONTEXTMENU command to show a context menu.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodTypeCharExecutes a TYPECHAR on the current command target chain.
Public methodUncommentSelectionHandles the UNCOMMENTBLOCK command to uncomment the current selection in the current view.
Top

  NameDescription
Explicit interface implemetationPrivate methodIOleCommandTarget.ExecHandles execution of a supported command.
Explicit interface implemetationPrivate methodIOleCommandTarget.QueryStatusDetermines if the specified commands in the given command group are supported.
Top

In addition to the cursor, Enter, Backspace, and Delete key commands, this base class provides support for the following commands:

Command

Description

AUTOCOMPLETE

IntelliSense: select member from member list.

SHOWMEMBERLIST

IntelliSense: show member list.

COMPLETEWORD

IntelliSense: complete word being typed.

PARAMINFO

IntelliSense: show parameter information.

QUICKINFO

IntelliSense: show information about an identifier.

GotoDefn

Editing (advanced): go to definition.

GotoDecl

Editing (advanced): go to declaration.

GotoRef

Editing (advanced): go to a reference.

COMMENT_BLOCK

Editing (advanced): comment a span of code.

UNCOMMENT_BLOCK

Editing (Advanced): uncomment a span of code.

OUTLN_STOP_HIDING_ALL

Editing (outlining): stop outlining.

OUTLN_START_AUTOHIDING

Editing (outlining): toggle outlining.

SHOWCONTEXTMENU

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:

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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft