IPersistentSpan Interface

Definition

Describes span in a document that remains valid even when the document is closed, opened or modified (while it is open).

public interface class IPersistentSpan : IDisposable
Implements

Remarks

PersistentSpans are similar to ITrackingSpans, except they can be created on closed documents and will continue to track even when a document is closed and reopened.

These spans only track changes made while the document is open. They will not track changes made to the document while the document is closed (through Notepad or something similar).

Properties

Document

Returns the span's ITextDocument if the underlying document is open (and null if the document is closed).

FilePath

Returns the file path of the document.

IsDocumentOpen

Returns true if the document associated with the IPersistentSpan is currently open.

Span

Returns the span's ITrackingSpan if the underlying document is open (and null if the document is closed).

Methods

TryGetEndLineIndex(Int32, Int32)

Get the ending point of the span as a line number and offset from the start of the line.

TryGetSpan(Span)

Get the span as a character offset from the start of the buffer.

TryGetStartLineIndex(Int32, Int32)

Get the starting point of the span as a line number and offset from the start of the line.

Applies to

Product Versions
Visual Studio SDK 2015, 2017, 2019, 2022