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

Method walk

src/sync/watcher.ts:510–532  ·  view source on GitHub ↗
(dir: string, linked: boolean)

Source from the content-addressed store, hash-verified

508 const desired = new Map<string, string>();
509 const recursive = supportsRecursiveWatch();
510 const walk = (dir: string, linked: boolean): void => {
511 if (this.shouldIgnoreDir(dir)) return;
512 let real: string;
513 try {
514 real = fs.realpathSync(dir);
515 if (this.visitedRealDirs.has(real)) return;
516 this.visitedRealDirs.add(real);
517 directories.set(dir, real);
518 if (!recursive || linked) desired.set(dir, real);
519 for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
520 const child = path.join(dir, entry.name);
521 if (entry.isDirectory()) {
522 walk(child, false);
523 } else if (entry.isSymbolicLink()) {
524 // Follow directory symlinks just like the indexer's walk. Realpath
525 // deduplication includes ordinary directories and the root itself.
526 try {
527 if (fs.statSync(child).isDirectory()) walk(child, true);
528 } catch { /* broken link */ }
529 }
530 }
531 } catch { /* removed or unreadable directory */ }
532 };
533 walk(this.projectRoot, false);
534 this.knownDirs = directories;
535 for (const dir of this.dirWatchers.keys()) {

Callers 15

find_descendantMethod · 0.80
extract_nameMethod · 0.80
signature_ofMethod · 0.80
visitMethod · 0.80
extract_variableMethod · 0.80
lua_static_field_nameMethod · 0.80
visit_bodyMethod · 0.80
maybe_capture_fn_refsMethod · 0.80
scan_fn_ref_subtreeMethod · 0.80
go_local_bindingsFunction · 0.80

Calls 6

shouldIgnoreDirMethod · 0.95
hasMethod · 0.80
walkFunction · 0.50
addMethod · 0.45
setMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected