Skip to content

Commit a0e39b4

Browse files
Clean up targets (#2791)
## Checklist - [/] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [/] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [/] I have not broken the cheatsheet --------- Co-authored-by: Phil Cohen <[email protected]>
1 parent 232c167 commit a0e39b4

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

packages/cursorless-engine/src/processTargets/targets/BaseTarget.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export abstract class BaseTarget<
6969
get editor() {
7070
return this.state.editor;
7171
}
72+
7273
get isReversed() {
7374
return this.state.isReversed;
7475
}
@@ -114,6 +115,7 @@ export abstract class BaseTarget<
114115
getInterior(): Target[] | undefined {
115116
return undefined;
116117
}
118+
117119
getBoundary(): Target[] | undefined {
118120
return undefined;
119121
}

packages/cursorless-engine/src/processTargets/targets/DocumentTarget.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { Range } from "@cursorless/common";
22
import { shrinkRangeToFitContent } from "../../util/selectionUtils";
3-
import type { CommonTargetParameters } from "./BaseTarget";
4-
import { BaseTarget } from "./BaseTarget";
3+
import { BaseTarget, type CommonTargetParameters } from "./BaseTarget";
54
import { PlainTarget } from "./PlainTarget";
65

76
export class DocumentTarget extends BaseTarget<CommonTargetParameters> {
@@ -13,16 +12,6 @@ export class DocumentTarget extends BaseTarget<CommonTargetParameters> {
1312
super(parameters);
1413
}
1514

16-
getLeadingDelimiterTarget() {
17-
return undefined;
18-
}
19-
getTrailingDelimiterTarget() {
20-
return undefined;
21-
}
22-
getRemovalRange(): Range {
23-
return this.contentRange;
24-
}
25-
2615
getInterior() {
2716
return [
2817
// Use plain target instead of interior target since we want the same content and removal range for a document interior.
@@ -34,6 +23,18 @@ export class DocumentTarget extends BaseTarget<CommonTargetParameters> {
3423
];
3524
}
3625

26+
getRemovalRange(): Range {
27+
return this.contentRange;
28+
}
29+
30+
getLeadingDelimiterTarget() {
31+
return undefined;
32+
}
33+
34+
getTrailingDelimiterTarget() {
35+
return undefined;
36+
}
37+
3738
protected getCloneParameters() {
3839
return this.state;
3940
}

0 commit comments

Comments
 (0)