Constructors

C new TextSpan(start: number, length: number) void

Creates a TextSpan instance beginning with the position Start and having the Length specified with length.

Parameters:
Name Type
start number
length number

Properties

P _length

P _start

Methods

M containsPosition(position: number) boolean

Determines whether the position lies within the span. Returns true if the position is greater than or equal to Start and strictly less than End, otherwise false.

Parameters:
Name Type Description
position number

The position to check.

Returns: { boolean }

M containsTextSpan(span: ts.TextSpan) boolean

Determines whether span falls completely within this span. Returns true if the specified span falls completely within this span, otherwise false.

Parameters:
Name Type Description
span ts.TextSpan

The span to check.

Returns: { boolean }

M end() number

Returns: { number }

M fromBounds(start: number, end: number) ts.TextSpan

Creates a new TextSpan from the given start and end positions as opposed to a position and length.

Parameters:
Name Type
start number
end number
Returns: { ts.TextSpan }

M intersection(span: ts.TextSpan) ts.TextSpan

Returns the intersection with the given span, or undefined if there is no intersection.

Parameters:
Name Type Description
span ts.TextSpan

The span to check.

Returns: { ts.TextSpan }

M intersectsWith(start: number, length: number) boolean

Parameters:
Name Type
start number
length number
Returns: { boolean }

M intersectsWithPosition(position: number) boolean

Determines whether the given position intersects this span. A position is considered to intersect if it is between the start and end positions (inclusive) of this span. Returns true if the position intersects, false otherwise.

Parameters:
Name Type Description
position number

The position to check.

Returns: { boolean }

M intersectsWithTextSpan(The: any, span: ts.TextSpan) boolean

Determines whether span intersects this span. Two spans are considered to intersect if they have positions in common or the end of one span coincides with the start of the other span. Returns true if the spans intersect, false otherwise.

Parameters:
Name Type Description
The

span to check.

span ts.TextSpan
Returns: { boolean }

M isEmpty() boolean

Returns: { boolean }

M length() number

Returns: { number }

M overlap(span: ts.TextSpan) ts.TextSpan

Returns the overlap with the given span, or undefined if there is no overlap.

Parameters:
Name Type Description
span ts.TextSpan

The span to check.

Returns: { ts.TextSpan }

M overlapsWith(span: ts.TextSpan) boolean

Determines whether the given span overlaps this span. Two spans are considered to overlap if they have positions in common and neither is empty. Empty spans do not overlap with any other span. Returns true if the spans overlap, false otherwise.

Parameters:
Name Type Description
span ts.TextSpan

The span to check.

Returns: { boolean }

M start() number

Returns: { number }

M toJSON(key: any) any

Parameters:
Name Type
key any
Returns: { any }