@@ -6,7 +6,10 @@ import {
6
6
} from "@cursorless/common" ;
7
7
import type { Target } from "../../typings/target.types" ;
8
8
import type { ModifierStageFactory } from "../ModifierStageFactory" ;
9
- import type { ModifierStage } from "../PipelineStages.types" ;
9
+ import type {
10
+ ModifierStage ,
11
+ ModifierStateOptions ,
12
+ } from "../PipelineStages.types" ;
10
13
import {
11
14
getModifierStagesFromTargetModifiers ,
12
15
processModifierStages ,
@@ -53,9 +56,9 @@ class BoundedLineStage implements ModifierStage {
53
56
private modifier : HeadModifier | TailModifier ,
54
57
) { }
55
58
56
- run ( target : Target ) : Target [ ] {
57
- const line = this . getContainingLine ( target ) ;
58
- const pairInterior = this . getContainingPairInterior ( target ) ;
59
+ run ( target : Target , options : ModifierStateOptions ) : Target [ ] {
60
+ const line = this . getContainingLine ( target , options ) ;
61
+ const pairInterior = this . getContainingPairInterior ( target , options ) ;
59
62
60
63
const intersection =
61
64
pairInterior != null
@@ -75,9 +78,12 @@ class BoundedLineStage implements ModifierStage {
75
78
] ;
76
79
}
77
80
78
- private getContainingPairInterior ( target : Target ) : Target | undefined {
81
+ private getContainingPairInterior (
82
+ target : Target ,
83
+ options : ModifierStateOptions ,
84
+ ) : Target | undefined {
79
85
try {
80
- return this . getContaining ( target , {
86
+ return this . getContaining ( target , options , {
81
87
type : "surroundingPairInterior" ,
82
88
delimiter : "any" ,
83
89
} ) [ 0 ] ;
@@ -89,15 +95,22 @@ class BoundedLineStage implements ModifierStage {
89
95
}
90
96
}
91
97
92
- private getContainingLine ( target : Target ) : Target {
93
- return this . getContaining ( target , {
98
+ private getContainingLine (
99
+ target : Target ,
100
+ options : ModifierStateOptions ,
101
+ ) : Target {
102
+ return this . getContaining ( target , options , {
94
103
type : "line" ,
95
104
} ) [ 0 ] ;
96
105
}
97
106
98
- private getContaining ( target : Target , scopeType : ScopeType ) : Target [ ] {
107
+ private getContaining (
108
+ target : Target ,
109
+ options : ModifierStateOptions ,
110
+ scopeType : ScopeType ,
111
+ ) : Target [ ] {
99
112
return this . modifierStageFactory
100
113
. create ( { type : "containingScope" , scopeType } )
101
- . run ( target ) ;
114
+ . run ( target , options ) ;
102
115
}
103
116
}
0 commit comments