Table of Contents

Struct SourcePosition

Namespace
RDCore.SDK.Model.Source
Assembly
RDCore.SDK.dll

A position in a source document, expressed as a zero-based line number and a zero-based character offset.

public readonly record struct SourcePosition : IComparable<SourcePosition>, IEquatable<SourcePosition>
Implements
Inherited Members
Extension Methods

Remarks

👉 Character offsets count UTF-16 code units, consistent with both the LSP default position encoding and the native encoding of VBA (BSTR) strings.

Constructors

SourcePosition(int, int)

A position in a source document, expressed as a zero-based line number and a zero-based character offset.

public SourcePosition(int Line, int Character)

Parameters

Line int

The zero-based line number.

Character int

The zero-based character (UTF-16 code unit) offset within the line.

Remarks

👉 Character offsets count UTF-16 code units, consistent with both the LSP default position encoding and the native encoding of VBA (BSTR) strings.

Properties

Character

The zero-based character (UTF-16 code unit) offset within the line.

public int Character { get; init; }

Property Value

int

Line

The zero-based line number.

public int Line { get; init; }

Property Value

int

Methods

CompareTo(SourcePosition)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public int CompareTo(SourcePosition other)

Parameters

other SourcePosition

An object to compare with this instance.

Returns

int

A value that indicates the relative order of the objects being compared. The return value has these meanings:

Value Meaning
Less than zero This instance precedes other in the sort order.
Zero This instance occurs in the same position in the sort order as other.
Greater than zero This instance follows other in the sort order.

Operators

operator >(SourcePosition, SourcePosition)

public static bool operator >(SourcePosition left, SourcePosition right)

Parameters

left SourcePosition
right SourcePosition

Returns

bool

operator >=(SourcePosition, SourcePosition)

public static bool operator >=(SourcePosition left, SourcePosition right)

Parameters

left SourcePosition
right SourcePosition

Returns

bool

operator <(SourcePosition, SourcePosition)

public static bool operator <(SourcePosition left, SourcePosition right)

Parameters

left SourcePosition
right SourcePosition

Returns

bool

operator <=(SourcePosition, SourcePosition)

public static bool operator <=(SourcePosition left, SourcePosition right)

Parameters

left SourcePosition
right SourcePosition

Returns

bool