LanguageService.CreateViewFilter Method
Instantiates a ViewFilter class.
Namespace: Microsoft.VisualStudio.Package
Assemblies: Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
Syntax
'Dichiarazione
Public Overridable Function CreateViewFilter ( _
mgr As CodeWindowManager, _
newView As IVsTextView _
) As ViewFilter
'Utilizzo
Dim instance As LanguageService
Dim mgr As CodeWindowManager
Dim newView As IVsTextView
Dim returnValue As ViewFilter
returnValue = instance.CreateViewFilter(mgr, _
newView)
public virtual ViewFilter CreateViewFilter(
CodeWindowManager mgr,
IVsTextView newView
)
public:
virtual ViewFilter^ CreateViewFilter(
CodeWindowManager^ mgr,
IVsTextView^ newView
)
abstract CreateViewFilter :
mgr:CodeWindowManager *
newView:IVsTextView -> ViewFilter
override CreateViewFilter :
mgr:CodeWindowManager *
newView:IVsTextView -> ViewFilter
public function CreateViewFilter(
mgr : CodeWindowManager,
newView : IVsTextView
) : ViewFilter
Parameters
- mgr
Type: Microsoft.VisualStudio.Package.CodeWindowManager
[in] The CodeWindowManager object to associate with this view filter.
- newView
Type: Microsoft.VisualStudio.TextManager.Interop.IVsTextView
[in] The IVsTextView object that is to receive the new view filter.
Return Value
Type: Microsoft.VisualStudio.Package.ViewFilter
If successful, returns a ViewFilter object; otherwise, returns a null value.
Remarks
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.
Examples
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.
base.GetIVsDebugger();
return new MyViewFilter(mgr, newView);
}
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.