Text Buffer Events in the Legacy API
The text buffer object emits several different events that allow you to respond to different situations.
When you are using the legacy API, you should implement the following interfaces in order to receive notification of changes to the text buffer. Expose the interfaces to the text buffer using the IConnectionPointContainer interface on the text buffer to receive notification of line changes from the buffer. For more information, see How to: Register for Text Buffer Events with the Legacy API. In the case of IVsTextStreamEvents or IVsTextLinesEvents interfaces, changes are returned in either one- or two-dimensional coordinates, respectively.
Text Buffer Interfaces
Following are the interfaces implemented by the text buffer object.
Interface |
Description |
---|---|
Enables the creation of compound actions (that is, actions that are grouped in a single undo/redo unit). |
|
Enables persistence of document data managed by the text buffer. |
|
Provides basic services; used by many clients. |
|
Provides read and write capabilities using two-dimensional coordinates. Inherits from IVsTextBuffer. |
|
Provides fast, stream-oriented, sequential access to text in the buffer. |
|
Provides read and write capabilities using one-dimensional coordinates. Inherits from IVsTextBuffer. |
|
Provides access to a generic collection of properties. The most important property is the name, or moniker, of the buffer. You can store your own random data in the buffer with this interface by creating a GUID and using it as a key. |
|
Supports connection points for events. |
Text Buffer Event Interfaces
Following are the interfaces for text buffer event notification.
Interface |
Description |
---|---|
Notifies clients when a new language service is associated with a text buffer. |
|
Notifies clients when a text buffer is initialized and when changes are made to data in the text buffer. |
|
Notifies clients of changes to the underlying text buffer in one-dimensional coordinates. |
|
Notifies clients of changes to the underlying text buffer in two-dimensional coordinates. |
|
Notifies clients of changes to user data. |
|
Notifies clients of the last commit gesture to trigger the event and provides the range of text changed. The IVsPreliminaryTextChangeCommitEvents interface is not fired in response to Undo or Redo commands. Events only fire for buffers that have an undo manager. IVsPreliminaryTextChangeCommitEvents is fired prior to other events, such as pretty listing, in order to make sure the other events do not alter the text before the changes are committed. Your VSPackage must monitor either the IVsPreliminaryTextChangeCommitEvents interface or the IVsFinalTextChangeCommitEvents interface, but not both. |
|
Notifies clients of the last commit gesture to trigger the event and provides the range of text changed. The IVsFinalTextChangeCommitEvents interface is not fired in response to Undo or Redo commands. Events only fire for buffers that have an undo manager. IVsFinalTextChangeCommitEvents is intended for use only by language services or other objects that have complete control over editing. Your VSPackage must monitor either the IVsPreliminaryTextChangeCommitEvents interface or the IVsFinalTextChangeCommitEvents interface, but not both. |
See Also
Tasks
How to: Register for Text Buffer Events with the Legacy API