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

Function runForEachEditor

src/util/targetUtils.ts:27–37  ·  view source on GitHub ↗
(
  targets: T[],
  getEditor: (target: T) => TextEditor,
  func: (editor: TextEditor, editorTargets: T[]) => Promise<U>
)

Source from the content-addressed store, hash-verified

25}
26
27export async function runForEachEditor<T, U>(
28 targets: T[],
29 getEditor: (target: T) => TextEditor,
30 func: (editor: TextEditor, editorTargets: T[]) => Promise<U>
31): Promise<U[]> {
32 return await Promise.all(
33 Array.from(groupBy(targets, getEditor), async ([editor, editorTargets]) =>
34 func(editor, editorTargets)
35 )
36 );
37}
38
39export async function runOnTargetsForEachEditor<T>(
40 targets: TypedSelection[],

Callers 5

runMethod · 0.90
runMethod · 0.90

Calls 2

groupByFunction · 0.90
funcFunction · 0.85

Tested by

no test coverage detected