File tree Expand file tree Collapse file tree 3 files changed +79
-0
lines changed
cursorless-engine/src/processTargets/targets
cursorless-vscode-e2e/src/suite/fixtures/recorded/subtoken Expand file tree Collapse file tree 3 files changed +79
-0
lines changed Original file line number Diff line number Diff line change 1
1
import { Range } from "@cursorless/common" ;
2
+ import { Target } from "../../typings/target.types" ;
2
3
import { tryConstructPlainTarget } from "../../util/tryConstructTarget" ;
4
+ import { isSameType } from "../../util/typeUtils" ;
5
+ import { createContinuousRange } from "../targetUtil/createContinuousRange" ;
3
6
import { getDelimitedSequenceRemovalRange } from "../targetUtil/insertionRemovalBehaviors/DelimitedSequenceInsertionRemovalBehavior" ;
4
7
import BaseTarget , { CommonTargetParameters } from "./BaseTarget" ;
5
8
@@ -43,6 +46,34 @@ export default class SubTokenWordTarget extends BaseTarget<SubTokenTargetParamet
43
46
return getDelimitedSequenceRemovalRange ( this ) ;
44
47
}
45
48
49
+ createContinuousRangeTarget (
50
+ isReversed : boolean ,
51
+ endTarget : Target ,
52
+ includeStart : boolean ,
53
+ includeEnd : boolean ,
54
+ ) : Target {
55
+ if ( isSameType ( this , endTarget ) ) {
56
+ return new SubTokenWordTarget ( {
57
+ ...this . getCloneParameters ( ) ,
58
+ isReversed,
59
+ contentRange : createContinuousRange (
60
+ this ,
61
+ endTarget ,
62
+ includeStart ,
63
+ includeEnd ,
64
+ ) ,
65
+ trailingDelimiterRange : endTarget . trailingDelimiterRange_ ,
66
+ } ) ;
67
+ }
68
+
69
+ return super . createContinuousRangeTarget (
70
+ isReversed ,
71
+ endTarget ,
72
+ includeStart ,
73
+ includeEnd ,
74
+ ) ;
75
+ }
76
+
46
77
protected getCloneParameters ( ) : SubTokenTargetParameters {
47
78
return {
48
79
...this . state ,
Original file line number Diff line number Diff line change
1
+ languageId : plaintext
2
+ command :
3
+ version : 5
4
+ spokenForm : chuck final two words
5
+ action : {name: remove}
6
+ targets :
7
+ - type : primitive
8
+ modifiers :
9
+ - type : ordinalScope
10
+ scopeType : {type: word}
11
+ start : -2
12
+ length : 2
13
+ usePrePhraseSnapshot : true
14
+ initialState :
15
+ documentContents : a_b_c
16
+ selections :
17
+ - anchor : {line: 0, character: 0}
18
+ active : {line: 0, character: 0}
19
+ marks : {}
20
+ finalState :
21
+ documentContents : a
22
+ selections :
23
+ - anchor : {line: 0, character: 0}
24
+ active : {line: 0, character: 0}
Original file line number Diff line number Diff line change
1
+ languageId : plaintext
2
+ command :
3
+ version : 5
4
+ spokenForm : chuck first two words
5
+ action : {name: remove}
6
+ targets :
7
+ - type : primitive
8
+ modifiers :
9
+ - type : ordinalScope
10
+ scopeType : {type: word}
11
+ start : 0
12
+ length : 2
13
+ usePrePhraseSnapshot : true
14
+ initialState :
15
+ documentContents : a_b_c
16
+ selections :
17
+ - anchor : {line: 0, character: 0}
18
+ active : {line: 0, character: 0}
19
+ marks : {}
20
+ finalState :
21
+ documentContents : c
22
+ selections :
23
+ - anchor : {line: 0, character: 0}
24
+ active : {line: 0, character: 0}
You can’t perform that action at this time.
0 commit comments