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

Function decoratorsForFile

src/graph/branch-guards.ts:2194–2209  ·  view source on GitHub ↗
(
  absPath: string,
  language: Language,
  lines: readonly number[]
)

Source from the content-addressed store, hash-verified

2192const MAX_DECORATOR_TEXT = 80;
2193
2194export async function decoratorsForFile(
2195 absPath: string,
2196 language: Language,
2197 lines: readonly number[]
2198): Promise<Map<number, DefinitionDecorators>> {
2199 const out = new Map<number, DefinitionDecorators>();
2200 if (!supportsBranchGuards(language) || lines.length === 0) return out;
2201 const cached = await treeFor(absPath, language);
2202 if (!cached) return out;
2203 for (const line of lines) {
2204 if (out.has(line)) continue;
2205 const found = decoratorsInTree(cached.tree.rootNode, cached.source, line);
2206 if (found !== null) out.set(line, found);
2207 }
2208 return out;
2209}
2210
2211/** {@link decoratorsForFile} over source text — the test surface. */
2212export async function decoratorsInSource(source: string, language: Language, line: number): Promise<DefinitionDecorators | null> {

Callers 1

decoratorsFunction · 0.90

Calls 5

supportsBranchGuardsFunction · 0.85
treeForFunction · 0.85
decoratorsInTreeFunction · 0.85
hasMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected