LanguageService.CreateViewFilter(CodeWindowManager, IVsTextView) Method


Instantiates a ViewFilter class.

 virtual Microsoft::VisualStudio::Package::ViewFilter ^ CreateViewFilter(Microsoft::VisualStudio::Package::CodeWindowManager ^ mgr, Microsoft::VisualStudio::TextManager::Interop::IVsTextView ^ newView);
public virtual Microsoft.VisualStudio.Package.ViewFilter CreateViewFilter (Microsoft.VisualStudio.Package.CodeWindowManager mgr, Microsoft.VisualStudio.TextManager.Interop.IVsTextView newView);
abstract member CreateViewFilter : Microsoft.VisualStudio.Package.CodeWindowManager * Microsoft.VisualStudio.TextManager.Interop.IVsTextView -> Microsoft.VisualStudio.Package.ViewFilter
override this.CreateViewFilter : Microsoft.VisualStudio.Package.CodeWindowManager * Microsoft.VisualStudio.TextManager.Interop.IVsTextView -> Microsoft.VisualStudio.Package.ViewFilter
Public Overridable Function CreateViewFilter (mgr As CodeWindowManager, newView As IVsTextView) As ViewFilter



[in] The CodeWindowManager object to associate with this view filter.


[in] The IVsTextView object that is to receive the new view filter.



If successful, returns a ViewFilter object; otherwise, returns a null value.


Here is an example implementation of this method. Note the call to the GetIVsDebugger method. The first time the GetIVsDebugger method is called, it hooks up the view to watch for debugger events. Without this call, your view does not receive any debugger events.

using Microsoft.VisualStudio.Package;  

namespace MyLanguagePackage  
    public class MyLanguageService : LanguageService  
        public override ViewFilter CreateViewFilter(CodeWindowManager mgr,  
                                                    IVsTextView newView)  
            // This call makes sure debugging events can be received  
            // by our view filter.  
            return new MyViewFilter(mgr, newView);  


A view filter provides handling for various commands the user can issue in Visual Studio. If your language service supports commands other than those supported by the default ViewFilter, you must derive a class from the ViewFilter class and return a new instance of your class from this method. See ViewFilter for details on supported commands.

The base method always returns a new ViewFilter object. This is typically called when the CodeWindowManager attaches to a new text view.

Applies to