共用方式為


IVsTextBufferCoordinator Interface

Definition

Provides mapping services between two buffers.

public interface class IVsTextBufferCoordinator
public interface class IVsTextBufferCoordinator
__interface IVsTextBufferCoordinator
[System.Runtime.InteropServices.Guid("84465401-2886-4CE0-AF50-C0560226ED40")]
[System.Runtime.InteropServices.InterfaceType(1)]
public interface IVsTextBufferCoordinator
[System.Runtime.InteropServices.Guid("84465401-2886-4CE0-AF50-C0560226ED40")]
[System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]
public interface IVsTextBufferCoordinator
[<System.Runtime.InteropServices.Guid("84465401-2886-4CE0-AF50-C0560226ED40")>]
[<System.Runtime.InteropServices.InterfaceType(1)>]
type IVsTextBufferCoordinator = interface
[<System.Runtime.InteropServices.Guid("84465401-2886-4CE0-AF50-C0560226ED40")>]
[<System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)>]
type IVsTextBufferCoordinator = interface
Public Interface IVsTextBufferCoordinator
Derived
Attributes

Remarks

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.

Methods

EnableReplication(UInt32, Int32)

Enables replication from primary to secondary buffer and replication from the secondary buffer to the primary.

EnumSpans(IVsEnumBufferCoordinatorSpans)

Returns a list of span mappings controlled by the buffer coordinator object.

GetMappingOfPrimaryPosition(Int32, TextSpan[], TextSpan[])

Maps the specified position in the primary buffer to the span in the secondary buffer.

GetPrimaryBuffer(IVsTextLines)

Returns the primary language buffer.

GetSecondaryBuffer(IVsTextLines)

Returns the secondary language buffer.

MapPrimaryToSecondarySpan(TextSpan, TextSpan[])

Maps the specified position in the primary buffer to a position in the secondary buffer.

MapSecondaryToPrimarySpan(TextSpan, TextSpan[])

Maps the specified position in the secondary buffer to a position in the primary buffer.

SetBufferMappingModes(UInt32, UInt32)

Establishes the mapping modes for both primary and secondary buffers.

SetBuffers(IVsTextLines, IVsTextLines)

Establishes the primary and secondary buffers that are to be managed by the buffer coordinator object.

SetSpanMappings(Int32, NewSpanMapping[])

Establishes the list of mappings between the primary and secondary buffers.

Applies to