File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
server/aws-lsp-codewhisperer/src/shared Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -533,15 +533,28 @@ export async function listFilesWithGitignore(directory: string): Promise<string[
533533 }
534534 }
535535
536- const absolutePaths = await fg ( [ '**/*' ] , {
536+ const absolutePaths : string [ ] = [ ]
537+ let fileCount = 0
538+ const MAX_FILES = 500_000
539+
540+ const stream = fg . stream ( [ '**/*' ] , {
537541 cwd : directory ,
538542 dot : true ,
539543 ignore : ignorePatterns ,
540- onlyFiles : false ,
544+ onlyFiles : true ,
541545 followSymbolicLinks : false ,
542546 absolute : true ,
543547 } )
544- return absolutePaths . slice ( 0 , 500_000 )
548+
549+ for await ( const entry of stream ) {
550+ if ( fileCount >= MAX_FILES ) {
551+ break
552+ }
553+ absolutePaths . push ( entry . toString ( ) )
554+ fileCount ++
555+ }
556+
557+ return absolutePaths
545558}
546559
547560export function getFileExtensionName ( filepath : string ) : string {
You can’t perform that action at this time.
0 commit comments