MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / opensParameters

Function opensParameters

src/resolution/callback-synthesizer.ts:2435–2442  ·  view source on GitHub ↗

* Whether the `(` at `paren` opens a parameter list: an arrow or a body * follows it, and no control-flow keyword precedes it (`if ([a, B].includes(x)) {`).

(code: string, paren: number)

Source from the content-addressed store, hash-verified

2433 * follows it, and no control-flow keyword precedes it (`if ([a, B].includes(x)) {`).
2434 */
2435function opensParameters(code: string, paren: number): boolean {
2436 const p = skipSpace(code, paren - 1, -1);
2437 if (ID_CHAR.test(code[p] ?? '') && CONTROL_HEADS.has(wordEndingAt(code, p))) return false;
2438 const close = matchingCloser(code, paren);
2439 if (close < 0) return false;
2440 PARAMETERS_END.lastIndex = close + 1;
2441 return PARAMETERS_END.test(code);
2442}
2443
2444/** Whether a property key ends at the `:` at `colon` and opens its element: `{ key:`, `, 'key':`, `, [key]:`. */
2445function keyOpensElement(code: string, colon: number): boolean {

Callers 1

bindsPatternFunction · 0.85

Calls 4

wordEndingAtFunction · 0.85
matchingCloserFunction · 0.85
hasMethod · 0.80
skipSpaceFunction · 0.70

Tested by

no test coverage detected