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

Function pickDefaultView

src/ui-server/api/map.ts:490–499  ·  view source on GitHub ↗
(
  files: ReadonlyArray<{ path: string; symbols: number; test: boolean }>,
  passThrough?: ReadonlySet<string>
)

Source from the content-addressed store, hash-verified

488 * then the picture worth opening on, when it draws more than one box.
489 */
490export function pickDefaultView(
491 files: ReadonlyArray<{ path: string; symbols: number; test: boolean }>,
492 passThrough?: ReadonlySet<string>
493): { root: string; depth: number } {
494 const root = pickDefaultRoot(files);
495 const depth = pickDefaultDepth(files, root, passThrough);
496 if (root === '' || tallyModules(files, root, depth, passThrough).count > 1) return { root, depth };
497 const wholeDepth = pickDefaultDepth(files, '', passThrough);
498 return tallyModules(files, '', wholeDepth, passThrough).count > 1 ? { root: '', depth: wholeDepth } : { root, depth };
499}
500
501// =============================================================================
502// Cache

Callers 2

ui-map-api.test.tsFile · 0.90
buildMapFunction · 0.85

Calls 3

pickDefaultRootFunction · 0.85
pickDefaultDepthFunction · 0.85
tallyModulesFunction · 0.85

Tested by

no test coverage detected