Class: RelativeInclusiveScopeStage
processTargets/modifiers/RelativeInclusiveScopeStage.RelativeInclusiveScopeStage
Handles relative modifiers that include targets intersecting with the input,
eg "two funks"
, "token backward"
, etc. Proceeds as follows:
- Gets all scopes intersecting with input target. For empty range, that will be the scope touching the input, preferring the one in the direction of RelativeScopeModifier.direction if the input is adjacent to two. For non-empty range, just queries {@link ScopeHandler.getScopesOverlappingRange}. These are called the offset 0 scopes, as they correspond to "offset 0".
- Subtracts the number of scopes at offset 0 from RelativeScopeModifier.length to determine how many more are needed, throwing an error if offset zero already has more scopes than needed.
- Calls {@link ScopeHandler.getScopeRelativeToPosition} starting from the
end of the last offset 0 scope if direction is forward (start of the first
if direction is backward). Uses
offset
determined from subtraction above to get enough scopes to result in RelativeScopeModifier.length total scopes. - Constructs a range target from the first offset 0 scope past the newly returned scope if direction is forward, or from last offset 0 scope if direction is backward.
Implements
Constructors
constructor
• new RelativeInclusiveScopeStage(modifier
)
Parameters
Name | Type |
---|---|
modifier | RelativeScopeModifier |
Defined in
processTargets/modifiers/RelativeInclusiveScopeStage.ts:44
Methods
run
▸ run(context
, target
): Target
[]
Parameters
Name | Type |
---|---|
context | ProcessedTargetsContext |
target | Target |
Returns
Target
[]
Implementation of
Defined in
processTargets/modifiers/RelativeInclusiveScopeStage.ts:46