IVsTextViewCreationListener Interface

Definition

A listener for when a text view adapter (IVsTextView) is created and initialized that has matching roles and was created over a text data model having a matching content type. Exporters must specify at least one ContentTypeAttribute and one TextViewRole, and should mark their export using the following attribute: [Export(typeof(IVsTextViewCreationListener))], along with [ContentType] and [TextViewRole].

public interface class IVsTextViewCreationListener
public interface class IVsTextViewCreationListener
__interface IVsTextViewCreationListener
public interface IVsTextViewCreationListener
type IVsTextViewCreationListener = interface
Public Interface IVsTextViewCreationListener

Examples

You can find examples of this interface in the following walkthroughs:

Walkthrough: Displaying Signature Help

Walkthrough: Displaying Statement Completion

Walkthrough: Using a Shortcut Key with an Editor Extension

Remarks

Exporters must mark their export using the following attribute:

[Export(typeof(IVsTextViewCreationListener))]   

You filter this listener for a specific ContentTypeAttribute and TextViewRoleAttribute.

For example, to restrict this listener to views of editable text, you would use the following attributes:

[Export(typeof(IVsTextViewCreationListener))]  
[ContentType("text")]  
[TextViewRole(PredefinedTextViewRoles.Editable)]  

For more information about using ContentTypeAttribute and TextViewRoleAttribute, see Language Service and Editor Extension Points.

You can use this listener when you want to handle specific keystrokes in your extension. You do this by getting a reference to the text view adapter (IVsTextView) when the text view is created, then using this reference to add a command filter to a view (by using AddCommandFilter).

Methods

VsTextViewCreated(IVsTextView)

Called when a IVsTextView adapter has been created and initialized.

Applies to