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

Function getOutsideOverflow

src/util/targetUtils.ts:47–71  ·  view source on GitHub ↗
(
  insideTarget: TypedSelection,
  outsideTarget: TypedSelection
)

Source from the content-addressed store, hash-verified

45
46/** Get the possible leading and trailing overflow ranges of the outside target compared to the inside target */
47export function getOutsideOverflow(
48 insideTarget: TypedSelection,
49 outsideTarget: TypedSelection
50): TypedSelection[] {
51 const { start: insideStart, end: insideEnd } =
52 insideTarget.selection.selection;
53 const { start: outsideStart, end: outsideEnd } =
54 outsideTarget.selection.selection;
55 const result = [];
56 if (outsideStart.isBefore(insideStart)) {
57 result.push(
58 createTypeSelection(
59 insideTarget.selection.editor,
60 outsideStart,
61 insideStart
62 )
63 );
64 }
65 if (outsideEnd.isAfter(insideEnd)) {
66 result.push(
67 createTypeSelection(insideTarget.selection.editor, insideEnd, outsideEnd)
68 );
69 }
70 return result;
71}
72
73function createTypeSelection(
74 editor: TextEditor,

Callers 1

runMethod · 0.90

Calls 1

createTypeSelectionFunction · 0.85

Tested by

no test coverage detected