Class: Position
libs/common/types/Position.Position
Constructors
constructor
• new Position(line
, character
)
Parameters
Name | Type | Description |
---|---|---|
line | number | A zero-based line value. |
character | number | A zero-based character value. |
Defined in
libs/common/types/Position.ts:18
Properties
character
• Readonly
character: number
The zero-based character value.
Defined in
libs/common/types/Position.ts:12
line
• Readonly
line: number
The zero-based line value.
Defined in
libs/common/types/Position.ts:7
Methods
compareTo
▸ compareTo(other
): number
Compare this to other
.
Parameters
Name | Type | Description |
---|---|---|
other | Position | A position. |
Returns
number
A number smaller than zero if this position is before the given position, a number greater than zero if this position is after the given position, or zero when this and the given position are equal.
Defined in
libs/common/types/Position.ts:98
isAfter
▸ isAfter(other
): boolean
Check if this position is after other
.
Parameters
Name | Type | Description |
---|---|---|
other | Position | A position. |
Returns
boolean
true
if position is on a greater line
or on the same line on a greater character.
Defined in
libs/common/types/Position.ts:58
isAfterOrEqual
▸ isAfterOrEqual(other
): boolean
Check if this position is after or equal to other
.
Parameters
Name | Type | Description |
---|---|---|
other | Position | A position. |
Returns
boolean
true
if position is on a greater line
or on the same line on a greater or equal character.
Defined in
libs/common/types/Position.ts:86
isBefore
▸ isBefore(other
): boolean
Check if this position is before other
.
Parameters
Name | Type | Description |
---|---|---|
other | Position | A position. |
Returns
boolean
true
if position is on a smaller line
or on the same line on a smaller character.
Defined in
libs/common/types/Position.ts:41
isBeforeOrEqual
▸ isBeforeOrEqual(other
): boolean
Check if this position is before or equal to other
.
Parameters
Name | Type | Description |
---|---|---|
other | Position | A position. |
Returns
boolean
true
if position is on a smaller line
or on the same line on a smaller or equal character.
Defined in
libs/common/types/Position.ts:75
isEqual
▸ isEqual(other
): boolean
Check if this position is equal to other
.
Parameters
Name | Type | Description |
---|---|---|
other | Position | A position. |
Returns
boolean
true
if the line and character of the given position are equal to
the line and character of this position.
Defined in
libs/common/types/Position.ts:30
toEmptyRange
▸ toEmptyRange(): Range
Create a new empty range from this position.
Returns
A Range
Defined in
libs/common/types/Position.ts:138
translate
▸ translate(lineDelta?
, characterDelta?
): Position
Create a new position relative to this position.
Parameters
Name | Type | Description |
---|---|---|
lineDelta? | number | Delta value for the line value, default is 0 . |
characterDelta? | number | Delta value for the character value, default is 0 . |
Returns
A position which line and character is the sum of the current line and character and the corresponding deltas.
Defined in
libs/common/types/Position.ts:127
with
▸ with(line?
, character?
): Position
Create a new position derived from this position.
Parameters
Name | Type | Description |
---|---|---|
line? | number | Value that should be used as line value, default is the existing value |
character? | number | Value that should be used as character value, default is the existing value |
Returns
A position where line and character are replaced by the given values.
Defined in
libs/common/types/Position.ts:115