MCPcopy Create free account
hub / github.com/cursorless-dev/cursorless / getRanges

Method getRanges

src/actions/InsertEmptyLines.ts:27–42  ·  view source on GitHub ↗
(targets: TypedSelection[])

Source from the content-addressed store, hash-verified

25 }
26
27 private getRanges(targets: TypedSelection[]) {
28 let lines = targets.flatMap((target) => {
29 const lines = [];
30 if (this.insertAbove) {
31 lines.push(target.selection.selection.start.line);
32 }
33 if (this.insertBelow) {
34 lines.push(target.selection.selection.end.line + 1);
35 }
36 return lines;
37 });
38 // Remove duplicates
39 lines = [...new Set(lines)];
40
41 return lines.map((line) => new Range(line, 0, line, 0));
42 }
43
44 private getEdits(ranges: Range[]) {
45 return ranges.map((range) => ({

Callers 1

runMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected