Udostępnij za pośrednictwem


IVsFinalTextChangeCommitEvents Interface

Definition

Notifies clients of the last commit gesture to trigger the event and provides the range of text changed.

public interface class IVsFinalTextChangeCommitEvents
public interface class IVsFinalTextChangeCommitEvents
__interface IVsFinalTextChangeCommitEvents
[System.Runtime.InteropServices.Guid("CE62717C-797D-445F-BC89-1D02C54CCF96")]
[System.Runtime.InteropServices.InterfaceType(1)]
public interface IVsFinalTextChangeCommitEvents
[System.Runtime.InteropServices.Guid("CE62717C-797D-445F-BC89-1D02C54CCF96")]
[System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]
public interface IVsFinalTextChangeCommitEvents
[<System.Runtime.InteropServices.Guid("CE62717C-797D-445F-BC89-1D02C54CCF96")>]
[<System.Runtime.InteropServices.InterfaceType(1)>]
type IVsFinalTextChangeCommitEvents = interface
[<System.Runtime.InteropServices.Guid("CE62717C-797D-445F-BC89-1D02C54CCF96")>]
[<System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)>]
type IVsFinalTextChangeCommitEvents = interface
Public Interface IVsFinalTextChangeCommitEvents
Derived
Attributes

Remarks

Language services or other parties who have total control over the editing experience are the only intended client of this interface.

Compound actions are actions that are grouped in a single Undo/Redo unit. When either the editor or an editor client (for example, language service) wants to create a compound action it calls OpenCompoundAction and CloseCompoundAction around whatever calls it makes to manipulate text. Each compound action contains commit gestures that would require the environment to fire a commit event for each; however, for a compound action, the environment fires only one commit event. This event is fired on the highest priority commit gesture or on the last commit gesture. For example, using Find and Replace, a user replaces six spans of text at once. Each of these replacements is potentially a commit gesture, but because this is a compound action, the environment waits until the end of the Find and Replace operation to fire a single commit event by calling OnChangesCommitted and passing in a value of CCG_MASS_REPLACE for the dwGestureFlags parameter.

IVsFinalTextChangeCommitEvents is only intended for use by language services or other objects that have complete control over editing. It is not fired in response to Undo or Redo commands, but only fires for buffers that have an Undo manager. By implementing IVsFinalTextChangeCommitEvents your language receives notification when the user performs certain committable actions. For more information, see ChangeCommitGestureFlags. In response to these actions, the language can take whatever action it needs to, such as reformatting text that might have been inserted. In general, these actions cannot be undone when the text change is undone because, for the most part, the Undo removes the text in question. For this reason, the commit event system is unresponsive to Undo/Redo. Clients who also want to track Undo/Redo events can use the Undo manager's cluster events to do so.

IVsPreliminaryTextChangeCommitEvents is very similar to IVsFinalTextChangeCommitEvents. The only difference is that IVsPreliminaryTextChangeCommitEvents gets fired by the environment before IVsFinalTextChangeCommitEvents and before other events, such as Reformat Selection. This is to ensure that the text in the buffer does not get corrupted prior to calling IVsPreliminaryTextChangeCommitEvents. You should implement either IVsFinalTextChangeCommitEvents or IVsPreliminaryTextChangeCommitEvents, but not both.

Notes to Implementers

Implement IVsFinalTextChangeCommitEvents on your client object to receive notification of changes to the text buffer object, VsTextBuffer. Expose this interface to the text buffer using the IConnectionPointContainer interface on the text buffer object VsTextBuffer . For more information, see How to: Register for Text Buffer Events with the Legacy API

Methods

OnChangesCommitted(UInt32, TextSpan[])

Notifies clients of the last commit gesture to trigger the event and provide the range of text changed.

Applies to