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

Method getTexts

src/actions/Replace.ts:25–41  ·  view source on GitHub ↗
(
    targets: TypedSelection[],
    replaceWith: string[] | RangeGenerator
  )

Source from the content-addressed store, hash-verified

23 }
24
25 private getTexts(
26 targets: TypedSelection[],
27 replaceWith: string[] | RangeGenerator
28 ): string[] {
29 if (Array.isArray(replaceWith)) {
30 // Broadcast single text to each target
31 if (replaceWith.length === 1) {
32 return Array(targets.length).fill(replaceWith[0]);
33 }
34 return replaceWith;
35 }
36 const numbers = [];
37 for (let i = 0; i < targets.length; ++i) {
38 numbers[i] = (replaceWith.start + i).toString();
39 }
40 return numbers;
41 }
42
43 async run(
44 [targets]: [TypedSelection[]],

Callers 1

runMethod · 0.80

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected