Skip to content

Add comment explaining why we need getRemovalHighlightRange #1643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/cursorless-engine/src/typings/target.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,19 @@ export interface Target {
/** The range of the delimiter after the content selection */
getTrailingDelimiterTarget(): Target | undefined;
getRemovalRange(): Range;

/**
* The range that should be highlighted when the target is removed. Note that
* we can't just use `getRemovalRange()`, because when we highlight a line for
* removal, we don't know which line to highlight just based on the removal
* range.
*
* For example, assume that the document, represented as a string, is `"\n"`.
* This corresponds to a document with two empty lines. If we say `"chuck
* line"` on either line, the removal range will be the entire document, but
* we want to highlight the line that they were on when they said `"chuck
* line"`, as that is logically the line they've deleted.
*/
getRemovalHighlightRange(): Range;
withThatTarget(thatTarget: Target): Target;
withContentRange(contentRange: Range): Target;
Expand Down