Skip to content

Commit 743d7e4

Browse files
authored
Add comment explaining why we need getRemovalHighlightRange (#1643)
## 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
1 parent 7448866 commit 743d7e4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/cursorless-engine/src/typings/target.types.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,19 @@ export interface Target {
136136
/** The range of the delimiter after the content selection */
137137
getTrailingDelimiterTarget(): Target | undefined;
138138
getRemovalRange(): Range;
139+
140+
/**
141+
* The range that should be highlighted when the target is removed. Note that
142+
* we can't just use `getRemovalRange()`, because when we highlight a line for
143+
* removal, we don't know which line to highlight just based on the removal
144+
* range.
145+
*
146+
* For example, assume that the document, represented as a string, is `"\n"`.
147+
* This corresponds to a document with two empty lines. If we say `"chuck
148+
* line"` on either line, the removal range will be the entire document, but
149+
* we want to highlight the line that they were on when they said `"chuck
150+
* line"`, as that is logically the line they've deleted.
151+
*/
139152
getRemovalHighlightRange(): Range;
140153
withThatTarget(thatTarget: Target): Target;
141154
withContentRange(contentRange: Range): Target;

0 commit comments

Comments
 (0)