Class CodeDocumentSnapshot
- Namespace
- CodeEdit.Maui
- Assembly
- CodeEdit.Maui.dll
An immutable plain-source snapshot.
public sealed class CodeDocumentSnapshot
- Inheritance
-
CodeDocumentSnapshot
- Inherited Members
Properties
Length
Gets the UTF-16 source length.
public int Length { get; }
Property Value
LineCount
Gets the number of logical source lines, including an empty trailing line.
public int LineCount { get; }
Property Value
Revision
Gets the captured document identity and version.
public DocumentRevision Revision { get; }
Property Value
Text
Gets the UTF-16 source text.
public string Text { get; }
Property Value
TextBuffer
Gets the persistent text storage represented by this snapshot.
public TextSnapshot TextBuffer { get; }
Property Value
Version
Gets the source revision.
public long Version { get; }
Property Value
Methods
GetLine(int)
Gets a zero-based source line with its exact terminator length.
public TextLine GetLine(int line)
Parameters
lineint
Returns
GetLineRange(int)
Gets a zero-based source line, excluding its terminator.
public TextSpan GetLineRange(int line)
Parameters
lineintThe zero-based logical line.
Returns
- TextSpan
The line's source range.
GetOffset(TextPosition)
Converts a zero-based line and UTF-16 column to an exact source offset.
public int GetOffset(TextPosition position)
Parameters
positionTextPositionThe source position.
Returns
- int
The source offset.
GetPosition(int)
Converts a UTF-16 source offset to a zero-based line and column.
public TextPosition GetPosition(int offset)
Parameters
offsetintThe source offset.
Returns
- TextPosition
The source position.
GetText(TextSpan)
Reads a bounded UTF-16 range without materializing the complete source.
public string GetText(TextSpan range)
Parameters
rangeTextSpan