@@ -8,6 +8,8 @@ import { randomUUID } from "crypto";
88export class WorkspaceService implements IWorkspaceService {
99 private static instance : WorkspaceService ;
1010 private readonly logger : Logger ;
11+ private readonly excludedDirectories = [ "node_modules" , "build" , ".git" , "dist" ] ;
12+ private readonly excludedFiles = [ "package-lock.json" , ".vscode" , ".env" ] ;
1113
1214 private constructor ( ) {
1315 this . logger = new Logger ( WorkspaceService . name ) ;
@@ -40,9 +42,9 @@ export class WorkspaceService implements IWorkspaceService {
4042 const entries = await fs . promises . readdir ( dir , { withFileTypes : true } ) ;
4143 for ( const entry of entries ) {
4244 const fullPath = path . join ( dir , entry . name ) ;
43- if ( entry . isDirectory ( ) && ! entry . name . includes ( ".git" ) ) {
45+ if ( entry . isDirectory ( ) && ! this . excludedDirectories . some ( ( dir ) => entry . name . includes ( dir ) ) ) {
4446 await this . traverseDirectory ( fullPath , workspaceFiles ) ;
45- } else if ( entry . isFile ( ) ) {
47+ } else if ( entry . isFile ( ) && ! this . excludedFiles . some ( ( file ) => entry . name . includes ( file ) ) ) {
4648 await this . readFileAndStore ( fullPath , workspaceFiles ) ;
4749 }
4850 }
@@ -116,10 +118,10 @@ export class WorkspaceService implements IWorkspaceService {
116118
117119 for ( const entry of entries ) {
118120 const fullPath = path . join ( dir , entry . name ) ;
119-
120- if ( entry . isDirectory ( ) && ! entry . name . includes ( ".git" ) ) {
121+ console . log ( "Entry Name:" , entry . name ) ;
122+ if ( entry . isDirectory ( ) && this . excludedDirectories . some ( ( dir ) => entry . name . includes ( dir ) ) ) {
121123 await this . traverseDirectoryForFolderMap ( fullPath , folderToFilesMap ) ;
122- } else if ( entry . isFile ( ) ) {
124+ } else if ( entry . isFile ( ) && ! this . excludedFiles . some ( ( file ) => entry . name . includes ( file ) ) ) {
123125 const rootPath = vscode . workspace . workspaceFolders ?. [ 0 ] ?. uri . fsPath ;
124126 if ( rootPath ) {
125127 const relativePath = path . relative ( rootPath , fullPath ) ;
@@ -150,10 +152,10 @@ export class WorkspaceService implements IWorkspaceService {
150152 for ( const entry of entries ) {
151153 const fullPath = path . join ( dir , entry . name ) ;
152154
153- if ( entry . isDirectory ( ) && ! entry . name . includes ( ".git" ) ) {
155+ if ( entry . isDirectory ( ) && ! this . excludedDirectories . some ( ( dir ) => entry . name . includes ( dir ) ) ) {
154156 const childFolder = await this . traverseDirectoryForStructure ( fullPath , rootPath ) ;
155157 folderEntry . children . push ( childFolder ) ;
156- } else if ( entry . isFile ( ) ) {
158+ } else if ( entry . isFile ( ) && ! this . excludedFiles . some ( ( file ) => entry . name . includes ( file ) ) ) {
157159 const fileEntry : FileEntry = {
158160 id : randomUUID ( ) ,
159161 type : "file" ,
0 commit comments