Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
IVsTextMarker Interface
Collapse the table of content
Expand the table of content

IVsTextMarker Interface

Provides methods for managing text markers.

Namespace: Microsoft.VisualStudio.TextManager.Interop
Assembly: Microsoft.VisualStudio.TextManager.Interop (in microsoft.visualstudio.textmanager.interop.dll)

[InterfaceTypeAttribute(1)] 
[GuidAttribute("950122D9-1A51-43CA-8CED-B5D9E42DE1B5")] 
public interface IVsTextMarker
/** @attribute InterfaceTypeAttribute(1) */ 
/** @attribute GuidAttribute("950122D9-1A51-43CA-8CED-B5D9E42DE1B5") */ 
public interface IVsTextMarker
InterfaceTypeAttribute(1) 
GuidAttribute("950122D9-1A51-43CA-8CED-B5D9E42DE1B5") 
public interface IVsTextMarker

The text marker tracks edits in its owning text buffer and maintains the position data so that interested parties can query the new position information post-edit.

NoteNote

If any part of the text range specified in the text marker is involved in an edit, the marker becomes invalid.

There are several ways that you can access IVsTextMarker:

  • Implement IVsTextMarkerClient. If you provide an IVsTextMarkerClient when you create the text marker using CreateLineMarker or CreateStreamMarker then the environment will call you with a pointer to IVsTextMarker whenever you need to provide a custom context menu, tip text, or need to change the appearance or behavior of a text marker that has moved.

  • Save the IVsTextMarker pointer. If you are only creating one or two specific markers, you can save the pointer to each of these markers for later use.

  • Query for the marker using IVsTextLines::EnumMarkers or EnumMarkers. If you do not want to wait for the IVsTextMarkerClient method to call you can access IVsTextMarker by using the following approach:

    • Call EnumMarkers to get a pointer to IVsEnumLineMarkers.

      -or-

    • Call EnumMarkers to get a pointer to IVsEnumStreamMarkers.

    • Call Next or Next to access the appropriate text marker. These methods will return the IVsTextLineMarker pointer for the text marker.

    • Call Query Interface from IVsTextLineMarker to obtain a pointer to IVsTextMarker.

See illustrations of the calling of this interface in the sample Figures Language Service Sample.

Notes to Callers Call IVsTextMarker when you need to track positional and edit information in the text buffer.

Community Additions

ADD
Show:
© 2015 Microsoft