Skip to content

Commit

Permalink
Clean up targets (#2791)
Browse files Browse the repository at this point in the history
## 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 <phillip@phillip.io>
  • Loading branch information
AndreasArvidsson and phillco authored Jan 30, 2025
1 parent 232c167 commit a0e39b4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export abstract class BaseTarget<
get editor() {
return this.state.editor;
}

get isReversed() {
return this.state.isReversed;
}
Expand Down Expand Up @@ -114,6 +115,7 @@ export abstract class BaseTarget<
getInterior(): Target[] | undefined {
return undefined;
}

getBoundary(): Target[] | undefined {
return undefined;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Range } from "@cursorless/common";
import { shrinkRangeToFitContent } from "../../util/selectionUtils";
import type { CommonTargetParameters } from "./BaseTarget";
import { BaseTarget } from "./BaseTarget";
import { BaseTarget, type CommonTargetParameters } from "./BaseTarget";
import { PlainTarget } from "./PlainTarget";

export class DocumentTarget extends BaseTarget<CommonTargetParameters> {
Expand All @@ -13,16 +12,6 @@ export class DocumentTarget extends BaseTarget<CommonTargetParameters> {
super(parameters);
}

getLeadingDelimiterTarget() {
return undefined;
}
getTrailingDelimiterTarget() {
return undefined;
}
getRemovalRange(): Range {
return this.contentRange;
}

getInterior() {
return [
// Use plain target instead of interior target since we want the same content and removal range for a document interior.
Expand All @@ -34,6 +23,18 @@ export class DocumentTarget extends BaseTarget<CommonTargetParameters> {
];
}

getRemovalRange(): Range {
return this.contentRange;
}

getLeadingDelimiterTarget() {
return undefined;
}

getTrailingDelimiterTarget() {
return undefined;
}

protected getCloneParameters() {
return this.state;
}
Expand Down

0 comments on commit a0e39b4

Please sign in to comment.