MCPcopy Create free account
hub / github.com/continuedev/continue / watchDirectory

Method watchDirectory

extensions/cli/src/util/fileWatcher.ts:161–183  ·  view source on GitHub ↗
(dirPath: string, depth: number = 0)

Source from the content-addressed store, hash-verified

159 }
160
161 private watchDirectory(dirPath: string, depth: number = 0): void {
162 if (
163 depth > this.options.maxDepth ||
164 this.shouldIgnorePath(dirPath) ||
165 this.watchedDirs.has(dirPath)
166 ) {
167 return;
168 }
169
170 try {
171 // Check if directory exists and is accessible
172 const stats = fs.statSync(dirPath);
173 if (!stats.isDirectory()) {
174 return;
175 }
176
177 this.watchedDirs.add(dirPath);
178 this.setupWatcher(dirPath, depth);
179 this.watchSubdirectories(dirPath, depth);
180 } catch (error) {
181 console.error(`Failed to watch directory ${dirPath}:`, error);
182 }
183 }
184
185 public startWatching(rootPath: string = process.cwd()): void {
186 this.stopWatching();

Callers 3

handleNewDirectoryMethod · 0.95
watchSubdirectoriesMethod · 0.95
startWatchingMethod · 0.95

Calls 5

shouldIgnorePathMethod · 0.95
setupWatcherMethod · 0.95
watchSubdirectoriesMethod · 0.95
errorMethod · 0.80
addMethod · 0.65

Tested by

no test coverage detected