Skip to main content

Class: ContainingScopeStage

processTargets/modifiers/ContainingScopeStage.ContainingScopeStage

This modifier stage expands from the input target to the smallest containing scope. We proceed as follows:

  1. Expand to smallest scope(s) touching start position of input target's content range
  2. If input target has an empty content range, return the start scope, breaking ties as defined by ScopeHandler.isPreferredOver when more than one scope touches content range
  3. Otherwise, if end of input target is weakly contained by the domain of the rightmost start scope, return rightmost start scope. We return rightmost because that will have non-empty intersection with input target content range.
  4. Otherwise, expand from end of input target and form a range from rightmost start scope through leftmost end scope. We use rightmost start scope and leftmost end scope because those will have non-empty intersection with input target content range.

Implements

Constructors

constructor

new ContainingScopeStage(modifier)

Parameters

NameType
modifierContainingScopeModifier

Defined in

processTargets/modifiers/ContainingScopeStage.ts:36

Methods

run

run(context, target): Target[]

Parameters

NameType
contextProcessedTargetsContext
targetTarget

Returns

Target[]

Implementation of

ModifierStage.run

Defined in

processTargets/modifiers/ContainingScopeStage.ts:38