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

Method run

src/actions/SetBreakpoint.ts:36–68  ·  view source on GitHub ↗
([targets]: [
    TypedSelection[],
    TypedSelection[]
  ])

Source from the content-addressed store, hash-verified

34 }
35
36 async run([targets]: [
37 TypedSelection[],
38 TypedSelection[]
39 ]): Promise<ActionReturnValue> {
40 await displayPendingEditDecorations(
41 targets,
42 this.graph.editStyles.referenced
43 );
44
45 const toAdd: Breakpoint[] = [];
46 const toRemove: Breakpoint[] = [];
47
48 targets.forEach((target) => {
49 const uri = target.selection.editor.document.uri;
50 const existing = getBreakpoints(uri, target.selection.selection);
51 if (existing.length > 0) {
52 toRemove.push(...existing);
53 } else {
54 toAdd.push(
55 new SourceBreakpoint(
56 new Location(uri, target.selection.selection.start)
57 )
58 );
59 }
60 });
61
62 debug.addBreakpoints(toAdd);
63 debug.removeBreakpoints(toRemove);
64
65 const thatMark = targets.map((target) => target.selection);
66
67 return { thatMark };
68 }
69}

Callers

nothing calls this directly

Calls 2

getBreakpointsFunction · 0.85

Tested by

no test coverage detected