Skip to main content

Module: util/getTokenComparator

Functions

getTokenComparator

getTokenComparator(selectionDisplayLine, selectionCharacterIndex): (a: Token, b: Token) => number

Gets a comparison function that can be used to sort tokens based on their distance from the current cursor in terms of display lines.

Parameters

NameTypeDescription
selectionDisplayLinenumberThe display line of the cursor location
selectionCharacterIndexnumberThe character index of current cursor within line

Returns

fn

▸ (a, b): number

Gets a comparison function that can be used to sort tokens based on their distance from the current cursor in terms of display lines.

Parameters
NameType
aToken
bToken
Returns

number

Defined in

util/getTokenComparator.ts:9