@@ -1506,13 +1506,57 @@ export class WorkspaceProvider
15061506
15071507 // Load .gitignore from all levels of the workspace
15081508 private async _load_all_gitignore_files ( ) : Promise < void > {
1509- const gitignore_files = await vscode . workspace . findFiles (
1510- '**/{.gitignore,.cursorignore,.codeiumignore}'
1511- )
1509+ const gitignore_files : string [ ] = [ ]
1510+ const visited = new Set < string > ( )
1511+
1512+ const walk = async ( dir_path : string ) => {
1513+ if ( visited . has ( dir_path ) ) return
1514+ visited . add ( dir_path )
1515+
1516+ try {
1517+ const entries = await fs . promises . readdir ( dir_path , {
1518+ withFileTypes : true
1519+ } )
1520+
1521+ for ( const entry of entries ) {
1522+ if ( entry . name == '.git' || entry . name == 'node_modules' ) continue
1523+
1524+ const full_path = path . join ( dir_path , entry . name )
1525+
1526+ let is_directory = entry . isDirectory ( )
1527+ if ( entry . isSymbolicLink ( ) ) {
1528+ try {
1529+ const stats = await fs . promises . stat ( full_path )
1530+ is_directory = stats . isDirectory ( )
1531+ } catch {
1532+ continue
1533+ }
1534+ }
1535+
1536+ if ( is_directory ) {
1537+ await walk ( full_path )
1538+ } else if (
1539+ [ '.gitignore' , '.cursorignore' , '.codeiumignore' ] . includes (
1540+ entry . name
1541+ )
1542+ ) {
1543+ gitignore_files . push ( full_path )
1544+ }
1545+ }
1546+ } catch ( error ) {
1547+ // Ignore read errors
1548+ }
1549+ }
1550+
1551+ for ( const root of this . _workspace_roots ) {
1552+ if ( fs . existsSync ( root ) ) {
1553+ await walk ( root )
1554+ }
1555+ }
1556+
15121557 this . _combined_gitignore = ignore ( )
15131558
1514- for ( const file_uri of gitignore_files ) {
1515- const gitignore_path = file_uri . fsPath
1559+ for ( const gitignore_path of gitignore_files ) {
15161560 const workspace_root = this . get_workspace_root_for_file ( gitignore_path )
15171561 if ( ! workspace_root ) continue
15181562
0 commit comments