Skip to main content

Module: processTargets/modifiers/surroundingPair

Functions

processSurroundingPair

processSurroundingPair(context, editor, range, scopeType): SurroundingPairInfo | null

Applies the surrounding pair modifier to the given selection. First looks to see if the target is itself adjacent to or contained by a modifier token. If so it will expand the selection to the opposite delimiter token. Otherwise, or if the opposite token wasn't found, it will proceed by finding the smallest pair of delimiters which contains the selection.

Parameters

NameTypeDescription
contextProcessedTargetsContextContext to be leveraged by modifier
editorTextEditorThe editor containing the range
rangeRangeThe range to process
scopeTypeSurroundingPairScopeTypeThe surrounding pair modifier information

Returns

SurroundingPairInfo | null

The new selection expanded to the containing surrounding pair or null if none was found

Defined in

processTargets/modifiers/surroundingPair/index.ts:30