Text View in Visual Studio
A text view, also known as an editor or a "view," is a window that lets you type, edit, and view Unicode text, which is stored in a text buffer. Use a text view whenever you want users to be able to view and edit text in your VSPackage.
Text View Object
Each view is associated with its own text buffer, and the view is a window on the data in the buffer. The following diagram shows the key interfaces of the text view object, which is represented by VsTextView.
Text view object
Because the view is separated from its buffer by various text layers such as word wrap, outlining text, and others, what you see in the editor is not necessarily an exact representation of the text in the buffer.
A view enables other services or processes to intercept incoming commands and act on them before the view acts on them. The most common service to do this is a language service. A language service might need, for example, to intercept the command for the ENTER key to provide custom indenting behavior or tool tips.
Adding Functionality to the Text View
The view provides basic functionality for word-extent and pair-extent features. You can customize view behavior even more to provide custom word-extent, data-tip, and pair-extent behavior for your language by implementing the IVsTextViewFilter interface. If you implement IVsTextViewFilter, this behavior is handled by your object, and is not handled by the view. When you implement IVsTextViewFilter on your object, provide a command filter (IOleCommandTarget) to monitor and intercept commands.
The text view uses sequential architecture for command filters. New command filters (IOleCommandTarget objects) are added to the sequence by calling the AddCommandFilter method.
Event notification for the text view is provided by using the T:Microsoft.VisualStudio.TextManager.Interop.IVsTextViewEvents interface. Implement this interface on your client object to receive notification of changes to the text view. Expose this interface to the text view by using the IConnectionPointContainer interface on the text view to receive notification of line changes from the view.