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

Function maybeAddDelimiter

src/util/getTextWithPossibleDelimiter.ts:15–29  ·  view source on GitHub ↗
(
  sourceText: string,
  destination: TypedSelection
)

Source from the content-addressed store, hash-verified

13
14/** Possibly add delimiter for positions before/after */
15export function maybeAddDelimiter(
16 sourceText: string,
17 destination: TypedSelection
18) {
19 const { insideOutsideType, position } = destination;
20 const containingListDelimiter =
21 destination.selectionContext.containingListDelimiter;
22 return containingListDelimiter == null ||
23 position === "contents" ||
24 insideOutsideType === "inside"
25 ? sourceText
26 : destination.position === "after"
27 ? containingListDelimiter + sourceText
28 : sourceText + containingListDelimiter;
29}

Callers 3

runMethod · 0.90
getEditsMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected