MCPcopy Index your code
hub / github.com/codeaashu/claude-code / removeSpans

Function removeSpans

src/utils/bash/treeSitterAnalysis.ts:178–189  ·  view source on GitHub ↗

* Removes spans from a string, returning the string with those character * ranges removed.

(command: string, spans: Array<[number, number]>)

Source from the content-addressed store, hash-verified

176 * ranges removed.
177 */
178function removeSpans(command: string, spans: Array<[number, number]>): string {
179 if (spans.length === 0) return command
180
181 // Drop inner spans that are fully contained in an outer one, then sort by
182 // start index descending so we can splice without offset shifts.
183 const sorted = dropContainedSpans(spans).sort((a, b) => b[0] - a[0])
184 let result = command
185 for (const [start, end] of sorted) {
186 result = result.slice(0, start) + result.slice(end)
187 }
188 return result
189}
190
191/**
192 * Replaces spans with just the quote delimiters (preserving ' and " characters).

Callers 1

extractQuoteContextFunction · 0.85

Calls 1

dropContainedSpansFunction · 0.85

Tested by

no test coverage detected