@@ -11,6 +11,8 @@ import { getWorkspacePath } from "../../../utils/path"
1111import * as path from "path"
1212import type { ClineProvider } from "../../webview/ClineProvider"
1313import { LRUCache } from "lru-cache"
14+ import { isPathInIgnoredDirectory } from "../../../services/glob/ignore-utils"
15+ import { scannerExtensions } from "../../../services/code-index/shared/supported-extensions"
1416
1517type FileEventHandler = ( uri : vscode . Uri ) => void
1618type RenameEventHandler = ( oldPath : vscode . Uri , newPath : vscode . Uri ) => void
@@ -231,7 +233,10 @@ export class WorkspaceEventMonitor {
231233
232234 try {
233235 watchPaths . forEach ( ( watchPath ) => {
234- const relPattern = new vscode . RelativePattern ( vscode . Uri . file ( watchPath ) , "**/*" )
236+ const relPattern = new vscode . RelativePattern (
237+ vscode . Uri . file ( watchPath ) ,
238+ `**/*{${ scannerExtensions . map ( ( e ) => e . substring ( 1 ) ) . join ( "," ) } }` ,
239+ )
235240 const watcher = vscode . workspace . createFileSystemWatcher ( relPattern )
236241
237242 watcher . onDidCreate ( ( uri ) => {
@@ -308,18 +313,15 @@ export class WorkspaceEventMonitor {
308313 }
309314
310315 // Then, check against our built-in patterns
311- if ( / ( ^ | [ \/ \\ ] ) \. . / . test ( filePath ) ) {
316+ if ( isPathInIgnoredDirectory ( filePath ) ) {
312317 return true
313318 }
314319
315320 // Additional checks based on file stats if available
316321 // Ignore directories that match certain patterns
317322 if ( stats . isDirectory ( ) ) {
318323 const dirName = path . basename ( filePath )
319- if (
320- dirName . startsWith ( "." ) ||
321- [ "node_modules" , "dist" , "build" , "out" , "coverage" , "tests" , "mocks" ] . includes ( dirName )
322- ) {
324+ if ( [ "tests" , "mocks" ] . includes ( dirName ) ) {
323325 return true
324326 }
325327 }
0 commit comments