ViewFilter Class

 

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

Namespace:   Microsoft.VisualStudio.Package
Assembly:  Microsoft.VisualStudio.Package.LanguageService.14.0 (in Microsoft.VisualStudio.Package.LanguageService.14.0.dll)

System.Object
  Microsoft.VisualStudio.Package.ViewFilter

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

NameDescription
System_CAPS_pubmethodViewFilter(CodeWindowManager, IVsTextView)

Initializes a new instance of the ViewFilter class.

NameDescription
System_CAPS_pubpropertyCodeWindowManager

Gets the CodeWindowManager that owns this ViewFilter.

System_CAPS_pubpropertySystem_CAPS_staticIsExecutingCommand

Determines whether or not the filter is executing commands.

System_CAPS_pubpropertyIsExpansionUIActive

Determines if the code snippet expansion user interface (UI) is active.

System_CAPS_protpropertySnippetBound

Gets or sets whether or not a key has been bound to the Invoke Snippet From Shortcut command.

System_CAPS_pubpropertySource

Gets the Source associated with this ViewFilter.

System_CAPS_pubpropertyTextTipData

Gets or sets the TextTipData associated with this view.

System_CAPS_pubpropertyTextView

Gets the IVsTextView object associated with this ViewFilter object.

NameDescription
System_CAPS_pubmethodCanReformat()

Determines whether the source can be reformatted by the language service.

System_CAPS_pubmethodClose()

Closes down the view filter, releasing any allocated resources.

System_CAPS_pubmethodCommentSelection()

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

System_CAPS_pubmethodCreateTextTipData()

Creates a new instance of the TextTipData class.

System_CAPS_pubmethodDispose()

Frees up any resources allocated when the ViewFilter class was created.

System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_protmethodExecCommand(Guid, UInt32, UInt32, IntPtr, IntPtr)

Executes the specified command.

System_CAPS_protmethodFinalize()

Performs final clean up just before the ViewFilter object is destroyed.(Overrides Object.Finalize().)

System_CAPS_pubmethodGetDataTipText(TextSpan[], String)

Returns text about the given span that can be shown in a tool tip.

System_CAPS_pubmethodGetExpansionProvider()

Returns an ExpansionProvider object.

System_CAPS_pubmethodGetFullDataTipText(String, TextSpan, String)

Returns a string that can be used in a tool tip, taking into account additional sources of text such as a debugger.

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetPairExtents(Int32, Int32, TextSpan[])

Returns the extent of the innermost matching pair of language elements that contains the given location.

System_CAPS_pubmethodGetSelection()

Returns the extent of the currently selected text.

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodGetWordExtent(Int32, Int32, UInt32, TextSpan[])

Returns the extent of the word or expression that contains the given location.

System_CAPS_pubmethodHandleGoto(VSConstants.VSStd97CmdID)

Processes the specified "go to" command.

System_CAPS_pubmethodHandlePostExec(Guid, UInt32, UInt32, IntPtr, IntPtr, Boolean)

Handles post-processing after a command has been executed.

System_CAPS_pubmethodHandlePreExec(Guid, UInt32, UInt32, IntPtr, IntPtr)

Handles pre-processing before a command is executed.

System_CAPS_pubmethodHandleQuickInfo()

Handles the QUICKINFO command to show tool tip information about the selected identifier or expression.

System_CAPS_pubmethodHandleSmartIndent()

Handles smart indentation.

System_CAPS_protmethodInnerExec(Guid, UInt32, UInt32, IntPtr, IntPtr)

Executes an IOleCommandTarget command.

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodOnAfterSnippetsKeyBindingChange(UInt32, UInt32, Int32)

Called after there has been a change in the key binding for the Invoke Snippet From Shortcut command.

System_CAPS_pubmethodOnAfterSnippetsUpdate()

Called whenever a folder that contains snippets has been updated and the snippets from that folder have been read in.

System_CAPS_pubmethodOnAutoComplete()

Called when the AUTOCOMPLETE command is received.

System_CAPS_pubmethodOnChangeCaretLine(IVsTextView, Int32, Int32)

Called when the caret moves to another line.

System_CAPS_pubmethodOnChangeScrollInfo(IVsTextView, Int32, Int32, Int32, Int32, Int32)

Called when the scroll information for the specified scroll bar has changed.

System_CAPS_pubmethodOnKillFocus(IVsTextView)

Called when the specified view loses focus.

System_CAPS_pubmethodOnSetBuffer(IVsTextView, IVsTextLines)

Called when the buffer of lines is being set or changed in the given view.

System_CAPS_pubmethodOnSetFocus(IVsTextView)

Called when the specified view gains focus.

System_CAPS_protmethodQueryCommandStatus(Guid, UInt32)

Determines if the specified command is supported.

System_CAPS_protmethodQueryParameterList(Guid, UInt32, UInt32, IntPtr, IntPtr)

Called to obtain the parameter for the specified command.

System_CAPS_pubmethodReformatDocument()

Handles the FORMATDOCUMENT command to reformat the entire document.

System_CAPS_pubmethodReformatSelection()

Handles the FORMATSELECTION command to reformat a selection.

System_CAPS_pubmethodRegisterExpansionManagerEventHandlers(IVsExpansionManager)

Registers event handlers IVsExpansionEvents.

System_CAPS_pubmethodRegisterTextViewEventHandlers(IVsTextView)

Register text view event handlers.

System_CAPS_pubmethodShowContextMenu(Int32, Guid, IOleCommandTarget, Int32, Int32)

Handles the SHOWCONTEXTMENU command to show a context menu.

System_CAPS_pubmethodToString()

(Inherited from Object.)

System_CAPS_pubmethodTypeChar(Char)

Executes a TYPECHAR on the current command target chain.

System_CAPS_pubmethodUncommentSelection()

Handles the UNCOMMENTBLOCK command to uncomment the current selection in the current view.

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIOleCommandTarget.Exec(Guid, UInt32, UInt32, IntPtr, IntPtr)

Handles execution of a supported command.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIOleCommandTarget.QueryStatus(Guid, UInt32, OLECMD[], IntPtr)

Determines if the specified commands in the given command group are supported.

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:

  • QueryCommandStatus (to indicate support for your commands)

  • QueryParameterList (if your commands require parameters)

  • HandlePreExec (if your commands require some set up)

  • M:Microsoft.VisualStudio.Package.ViewFilter.HandlePostExec(System.Guid@,System.UInt32,System.UInt32,System.IntPtr,System.IntPtr) (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.

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

Return to top
Show: