We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

IVsTextBufferCoordinator Interface

Provides mapping services between two buffers.

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop.8.0 (in Microsoft.VisualStudio.TextManager.Interop.8.0.dll)

public interface IVsTextBufferCoordinator

The IVsTextBufferCoordinator type exposes the following members.

Public methodEnableReplicationEnables replication from primary to secondary buffer and replication from the secondary buffer to the primary.
Public methodEnumSpansReturns a list of span mappings controlled by the buffer coordinator object.
Public methodGetMappingOfPrimaryPositionMaps the specified position in the primary buffer to the span in the secondary buffer.
Public methodGetPrimaryBufferReturns the primary language buffer.
Public methodGetSecondaryBufferReturns the secondary language buffer.
Public methodMapPrimaryToSecondarySpanMaps the specified position in the primary buffer to a position in the secondary buffer.
Public methodMapSecondaryToPrimarySpanMaps the specified position in the secondary buffer to a position in the primary buffer.
Public methodSetBufferMappingModesEstablishes the mapping modes for both primary and secondary buffers.
Public methodSetBuffersEstablishes the primary and secondary buffers that are to be managed by the buffer coordinator object.
Public methodSetSpanMappingsEstablishes the list of mappings between the primary and secondary buffers.

Some files can contain blocks of code from more than one language, for example, an ASP.NET file can contain code blocks from VBScript or JScript. These types of files are handled by displaying the file in a primary buffer and putting each of the code blocks into a secondary buffer. The secondary buffer can then be handed to a language service for formatting and display without regard to how the code block is contained in the primary file.

In order for this two buffer system to work, a way must be made available to map positions from one buffer to the other and that is where the text buffer coordinator, as represented by the IVsTextBufferCoordinator interface comes in. This interface manages two buffers in terms of a list of spans describing the locations associated with a particular code block.

Notes to Implementers

Visual Studio implements this interface.

Notes to Callers

An instance of this interface can be obtained by calling the CoCreateInstance function with the GUID of the VsTextBufferCoordinatorClass type as the CLSID.