fix: align codebase indexing with list-files hidden directory filtering #4709
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes issue #4647 where
.rooignorepatterns for hidden directories (like.next) in nested projects were not being respected during codebase indexing.Problem
The root cause was that
list-files.tshad a blanket.*exclusion for hidden directories at the ripgrep level, which prevented.rooignorefrom ever seeing those paths. This meant that even if you added.nextto.rooignore, it wouldn't work for codebase indexing because the files were already filtered out before.rooignorecould process them.Solution
Instead of modifying
list-files.ts(which would have broader implications), this PR aligns the codebase indexing behavior withlist-files.tsby:DIRS_TO_IGNOREconstant that includes the.*patternisPathInIgnoredDirectorythat checks if a path is in an ignored directoryscanner.tsandfile-watcher.tsnow use this shared filtering logicChanges
src/services/glob/constants.tswith sharedDIRS_TO_IGNOREconstantsrc/services/glob/ignore-utils.tswithisPathInIgnoredDirectoryhelperlist-files.tsto use the shared constantscanner.tsto filter out hidden directories after getting file listfile-watcher.tsto filter out hidden directories in file eventsscanner.spec.tsfor hidden directory filteringfile-watcher.spec.tsfor file watcher filteringTesting
All tests pass and the linting/type checking is clean. The new tests verify that:
.git,.hidden,.next, etc.) are not processed during scanningImpact
This change ensures that codebase indexing respects the same directory exclusions as
list-files.ts, providing consistent behavior across the extension. The performance impact is minimal as the filtering only involves string operations.Fixes #4647
Important
Fixes hidden directory exclusion issue in indexing by aligning
list-files.tswith.rooignoreusing shared constants and helper functions..rooignorenot respecting hidden directories during indexing.isPathInIgnoredDirectoryto check if a path is in an ignored directory.scanner.tsandfile-watcher.tsto use shared filtering logic.DIRS_TO_IGNOREinconstants.tsfor shared directory exclusion patterns.isPathInIgnoredDirectoryinignore-utils.tsfor path checking.file-watcher.spec.tsto test file watcher behavior with hidden directories.scanner.spec.tsto test directory scanning with hidden directories.list-files.tsto useDIRS_TO_IGNOREfor consistent directory filtering.This description was created by
for 1cc57d4. You can customize this summary. It will automatically update as commits are pushed.