ViewFilter ViewFilter ViewFilter Class

Definition

Important

This API is not CLS-compliant.

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

[System.CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(true)]
public class ViewFilter : IDisposable, Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget, Microsoft.VisualStudio.TextManager.Interop.IVsExpansionEvents, Microsoft.VisualStudio.TextManager.Interop.IVsTextViewEvents, Microsoft.VisualStudio.TextManager.Interop.IVsTextViewFilter
type ViewFilter = class
    interface IVsTextViewFilter
    interface IVsTextViewEvents
    interface IOleCommandTarget
    interface IDisposable
    interface IVsExpansionEvents
Public Class ViewFilter
Implements IDisposable, IOleCommandTarget, IVsExpansionEvents, IVsTextViewEvents, IVsTextViewFilter
Inheritance
ViewFilterViewFilterViewFilter
Attributes
Implements

Remarks

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 Inheritors

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:

Notes to Callers

This class is instantiated in the CreateViewFilter(CodeWindowManager, IVsTextView) method of the LanguageService class that is in turn called from the OnNewView(IVsTextView) method in the CodeWindowManager class when a view is attached to a source file.

Constructors

ViewFilter(CodeWindowManager, IVsTextView) ViewFilter(CodeWindowManager, IVsTextView) ViewFilter(CodeWindowManager, IVsTextView)

Initializes a new instance of the ViewFilter class.

Properties

CodeWindowManager CodeWindowManager CodeWindowManager

Gets the CodeWindowManager that owns this ViewFilter.

IsExecutingCommand IsExecutingCommand IsExecutingCommand

Determines whether or not the filter is executing commands.

IsExpansionUIActive IsExpansionUIActive IsExpansionUIActive

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

SnippetBound SnippetBound SnippetBound

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

Source Source Source

Gets the Source associated with this ViewFilter.

TextTipData TextTipData TextTipData

Gets or sets the TextTipData associated with this view.

TextView TextView TextView

Gets the IVsTextView object associated with this ViewFilter object.

Methods

CanReformat() CanReformat() CanReformat()

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

Close() Close() Close()

Closes down the view filter, releasing any allocated resources.

CommentSelection() CommentSelection() CommentSelection()

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

CreateTextTipData() CreateTextTipData() CreateTextTipData()

Creates a new instance of the TextTipData class.

Dispose() Dispose() Dispose()

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

ExecCommand(Guid, UInt32, UInt32, IntPtr, IntPtr) ExecCommand(Guid, UInt32, UInt32, IntPtr, IntPtr) ExecCommand(Guid, UInt32, UInt32, IntPtr, IntPtr)

Executes the specified command.

Finalize() Finalize() Finalize()

Performs final clean up just before the ViewFilter object is destroyed.

GetDataTipText(TextSpan[], String) GetDataTipText(TextSpan[], String) GetDataTipText(TextSpan[], String)

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

GetExpansionProvider() GetExpansionProvider() GetExpansionProvider()

Returns an ExpansionProvider object.

GetFullDataTipText(String, TextSpan, String) GetFullDataTipText(String, TextSpan, String) GetFullDataTipText(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.

GetPairExtents(Int32, Int32, TextSpan[]) GetPairExtents(Int32, Int32, TextSpan[]) GetPairExtents(Int32, Int32, TextSpan[])

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

GetSelection() GetSelection() GetSelection()

Returns the extent of the currently selected text.

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

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

HandleGoto(VSConstants+VSStd97CmdID) HandleGoto(VSConstants+VSStd97CmdID) HandleGoto(VSConstants+VSStd97CmdID)

Processes the specified "go to" command.

HandlePostExec(Guid, UInt32, UInt32, IntPtr, IntPtr, Boolean) HandlePostExec(Guid, UInt32, UInt32, IntPtr, IntPtr, Boolean) HandlePostExec(Guid, UInt32, UInt32, IntPtr, IntPtr, Boolean)

Handles post-processing after a command has been executed.

HandlePreExec(Guid, UInt32, UInt32, IntPtr, IntPtr) HandlePreExec(Guid, UInt32, UInt32, IntPtr, IntPtr) HandlePreExec(Guid, UInt32, UInt32, IntPtr, IntPtr)

Handles pre-processing before a command is executed.

HandleQuickInfo() HandleQuickInfo() HandleQuickInfo()

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

HandleSmartIndent() HandleSmartIndent() HandleSmartIndent()

Handles smart indentation.

InnerExec(Guid, UInt32, UInt32, IntPtr, IntPtr) InnerExec(Guid, UInt32, UInt32, IntPtr, IntPtr) InnerExec(Guid, UInt32, UInt32, IntPtr, IntPtr)

Executes an IOleCommandTarget command.

OnAfterSnippetsKeyBindingChange(UInt32, UInt32, Int32) OnAfterSnippetsKeyBindingChange(UInt32, UInt32, Int32) OnAfterSnippetsKeyBindingChange(UInt32, UInt32, Int32)

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

OnAfterSnippetsUpdate() OnAfterSnippetsUpdate() OnAfterSnippetsUpdate()

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

OnAutoComplete() OnAutoComplete() OnAutoComplete()

Called when the AUTOCOMPLETE command is received.

OnChangeCaretLine(IVsTextView, Int32, Int32) OnChangeCaretLine(IVsTextView, Int32, Int32) OnChangeCaretLine(IVsTextView, Int32, Int32)

Called when the caret moves to another line.

OnChangeScrollInfo(IVsTextView, Int32, Int32, Int32, Int32, Int32) OnChangeScrollInfo(IVsTextView, Int32, Int32, Int32, Int32, Int32) OnChangeScrollInfo(IVsTextView, Int32, Int32, Int32, Int32, Int32)

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

OnKillFocus(IVsTextView) OnKillFocus(IVsTextView) OnKillFocus(IVsTextView)

Called when the specified view loses focus.

OnSetBuffer(IVsTextView, IVsTextLines) OnSetBuffer(IVsTextView, IVsTextLines) OnSetBuffer(IVsTextView, IVsTextLines)

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

OnSetFocus(IVsTextView) OnSetFocus(IVsTextView) OnSetFocus(IVsTextView)

Called when the specified view gains focus.

QueryCommandStatus(Guid, UInt32) QueryCommandStatus(Guid, UInt32) QueryCommandStatus(Guid, UInt32)

Determines if the specified command is supported.

QueryParameterList(Guid, UInt32, UInt32, IntPtr, IntPtr) QueryParameterList(Guid, UInt32, UInt32, IntPtr, IntPtr) QueryParameterList(Guid, UInt32, UInt32, IntPtr, IntPtr)

Called to obtain the parameter for the specified command.

ReformatDocument() ReformatDocument() ReformatDocument()

Handles the FORMATDOCUMENT command to reformat the entire document.

ReformatSelection() ReformatSelection() ReformatSelection()

Handles the FORMATSELECTION command to reformat a selection.

RegisterExpansionManagerEventHandlers(IVsExpansionManager) RegisterExpansionManagerEventHandlers(IVsExpansionManager) RegisterExpansionManagerEventHandlers(IVsExpansionManager)

Registers event handlers IVsExpansionEvents.

RegisterTextViewEventHandlers(IVsTextView) RegisterTextViewEventHandlers(IVsTextView) RegisterTextViewEventHandlers(IVsTextView)

Register text view event handlers.

ShowContextMenu(Int32, Guid, IOleCommandTarget, Int32, Int32) ShowContextMenu(Int32, Guid, IOleCommandTarget, Int32, Int32) ShowContextMenu(Int32, Guid, IOleCommandTarget, Int32, Int32)

Handles the SHOWCONTEXTMENU command to show a context menu.

TypeChar(Char) TypeChar(Char) TypeChar(Char)

Executes a TYPECHAR on the current command target chain.

UncommentSelection() UncommentSelection() UncommentSelection()

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

Explicit Interface Implementations

IOleCommandTarget.Exec(Guid, UInt32, UInt32, IntPtr, IntPtr) IOleCommandTarget.Exec(Guid, UInt32, UInt32, IntPtr, IntPtr) IOleCommandTarget.Exec(Guid, UInt32, UInt32, IntPtr, IntPtr)

Handles execution of a supported command.

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

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

Extension Methods

FindAncestor<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>) FindAncestor<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>) FindAncestor<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>)
FindAncestor<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>) FindAncestor<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>) FindAncestor<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>)

Microsoft internal use only.

FindAncestorOrSelf<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>) FindAncestorOrSelf<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>) FindAncestorOrSelf<TElementType>(TElementType, Func<TElementType,TElementType>, Func<TElementType,Boolean>)
FindAncestorOrSelf<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>) FindAncestorOrSelf<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>) FindAncestorOrSelf<TAncestorType,TElementType>(TElementType, Func<TElementType,TElementType>)
IsAncestorOf<TElementType>(TElementType, TElementType, Func<TElementType,TElementType>) IsAncestorOf<TElementType>(TElementType, TElementType, Func<TElementType,TElementType>) IsAncestorOf<TElementType>(TElementType, TElementType, Func<TElementType,TElementType>)

Microsoft internal use only.

Applies to