IVsTextBuffer Interface

 

Acts as the base interface for the VsTextBuffer object and provides general information about the text buffer's properties. Also see IVsTextBufferEx, which adds GetTrackChanges and SetTrackChangesSuppression methods.

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

[GuidAttribute("C08E5275-0D26-4DE9-8892-994024C23750")]
[InterfaceTypeAttribute(1)]
public interface IVsTextBuffer

NameDescription
System_CAPS_pubmethodGetLanguageServiceID(Guid)

Returns the unique identifier of the language that is providing colorization and other attribute data to this buffer.

System_CAPS_pubmethodGetLastLineIndex(Int32, Int32)

Returns the last line in the text buffer.

System_CAPS_pubmethodGetLengthOfLine(Int32, Int32)

Returns the length of a line in the buffer.

System_CAPS_pubmethodGetLineCount(Int32)

Returns the number of lines in the buffer.

System_CAPS_pubmethodGetLineIndexOfPosition(Int32, Int32, Int32)

Returns the line and column numbers in the text buffer, given a position number.

System_CAPS_pubmethodGetPositionOfLine(Int32, Int32)

Returns the position number of a line.

System_CAPS_pubmethodGetPositionOfLineIndex(Int32, Int32, Int32)

Returns the position number in the text buffer, given a line and column number.

System_CAPS_pubmethodGetSize(Int32)

Returns the size in characters of the buffer.

System_CAPS_pubmethodGetStateFlags(UInt32)

Returns the state flags of the text buffer.

System_CAPS_pubmethodGetUndoManager(IOleUndoManager)

Returns the undo manager for this buffer.

System_CAPS_pubmethodInitializeContent(String, Int32)

Initializes the content of the text buffer.

System_CAPS_pubmethodLockBuffer()

Has no effect. Deprecated.

System_CAPS_pubmethodLockBufferEx(UInt32)

Has no effect. Deprecated.

System_CAPS_pubmethodReload(Int32)

Reloads the text buffer.

System_CAPS_pubmethodReserved1()

Reserved in the Vtable for future use.

System_CAPS_pubmethodReserved10()

Reserved in the Vtable for future use.

System_CAPS_pubmethodReserved2()

Reserved in the Vtable for future use.

System_CAPS_pubmethodReserved3()

Reserved in the Vtable for future use.

System_CAPS_pubmethodReserved4()

Reserved in the Vtable for future use.

System_CAPS_pubmethodReserved5()

Reserved in the Vtable for future use.

System_CAPS_pubmethodReserved6()

Reserved in the Vtable for future use.

System_CAPS_pubmethodReserved7()

Reserved in the Vtable for future use.

System_CAPS_pubmethodReserved8()

Reserved in the Vtable for future use.

System_CAPS_pubmethodReserved9()

Reserved in the Vtable for future use.

System_CAPS_pubmethodSetLanguageServiceID(Guid)

Sets the unique identifier of the language that is providing colorization and other attribute data to the buffer.

System_CAPS_pubmethodSetStateFlags(UInt32)

Sets the state flags of the text buffer.

System_CAPS_pubmethodUnlockBuffer()

Has no effect. Deprecated.

System_CAPS_pubmethodUnlockBufferEx(UInt32)

Has no effect. Deprecated.

The IVsTextBuffer interface provides basic services and text buffer properties, and is used by many clients. It contains information such as whether the buffer is read-only, whether the buffer has been modified, and which language service is associated with the buffer.

System_CAPS_importantImportant

Starting in Visual Studio 2010, you should access the text buffer on the UI thread, not on background threads. The text buffer no longer gets locked when you call LockBuffer or LockBufferEx. Similarly, the UnlockBuffer and UnlockBufferEx methods no longer have any effect.

IVsTextBuffer fires the IVsTextBufferEvents interface when there is a change in the language service. At the same time, the system notifies you of the switch to a different language service.

For the current buffer implementation, it is faster to read data from the interface IVsTextLines than to use IVsTextBuffer.

The position values used in this interface are a zero-based character index into a Unicode stream. It is always the caller's responsibility to ensure that requests do not index positions past the end of the buffer. Call the method GetSize to determine the character index position.

Notes to Callers:

This interface is implemented as part of the VsTextBuffer object. As a VSPackage implementer, you call QueryInterface to get a pointer to the IVsTextBuffer interface when using the core editor objects.

Return to top
Show: