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

Method walk

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

Source from the content-addressed store, hash-verified

490 const desired = new Map<string, string>();
491 const recursive = supportsRecursiveWatch();
492 const walk = (dir: string, linked: boolean): void => {
493 if (this.shouldIgnoreDir(dir)) return;
494 let real: string;
495 try {
496 real = fs.realpathSync(dir);
497 if (this.visitedRealDirs.has(real)) return;
498 this.visitedRealDirs.add(real);
499 directories.set(dir, real);
500 if (!recursive || linked) desired.set(dir, real);
501 for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
502 const child = path.join(dir, entry.name);
503 if (entry.isDirectory()) {
504 walk(child, false);
505 } else if (entry.isSymbolicLink()) {
506 // Follow directory symlinks just like the indexer's walk. Realpath
507 // deduplication includes ordinary directories and the root itself.
508 try {
509 if (fs.statSync(child).isDirectory()) walk(child, true);
510 } catch { /* broken link */ }
511 }
512 }
513 } catch { /* removed or unreadable directory */ }
514 };
515 walk(this.projectRoot, false);
516 this.knownDirs = directories;
517 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
val_var_nameMethod · 0.80

Calls 6

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

Tested by

no test coverage detected