Skip to content

Commit 9c0864c

Browse files
committed
fix: Use relative paths in scanner and file-watcher to avoid filtering workspaces under hidden parent directories
- Modified scanner.ts to use relativeFilePath instead of filePath when checking isPathInIgnoredDirectory - Modified file-watcher.ts to calculate relativeFilePath earlier and use it for isPathInIgnoredDirectory check - This prevents workspaces located under hidden parent directories (e.g., .root) from being incorrectly filtered out during both initial indexing and file watching - Ensures both initial indexing and incremental updates work correctly for all workspace locations
1 parent 3a47c55 commit 9c0864c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/services/code-index/processors/file-watcher.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,12 @@ export class FileWatcher implements IFileWatcher {
508508
*/
509509
async processFile(filePath: string): Promise<FileProcessingResult> {
510510
try {
511+
// Calculate relative path for ignore checks
512+
const relativeFilePath = generateRelativeFilePath(filePath, this.workspacePath)
513+
511514
// Check if file is in an ignored directory
512-
if (isPathInIgnoredDirectory(filePath)) {
515+
// Use relative path to avoid filtering out workspaces under hidden parent directories
516+
if (isPathInIgnoredDirectory(relativeFilePath)) {
513517
return {
514518
path: filePath,
515519
status: "skipped" as const,
@@ -518,7 +522,6 @@ export class FileWatcher implements IFileWatcher {
518522
}
519523

520524
// Check if file should be ignored
521-
const relativeFilePath = generateRelativeFilePath(filePath, this.workspacePath)
522525
if (
523526
!this.ignoreController.validateAccess(filePath) ||
524527
(this.ignoreInstance && this.ignoreInstance.ignores(relativeFilePath))

src/services/code-index/processors/scanner.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ export class DirectoryScanner implements IDirectoryScanner {
9696
const relativeFilePath = generateRelativeFilePath(filePath, scanWorkspace)
9797

9898
// Check if file is in an ignored directory using the shared helper
99-
if (isPathInIgnoredDirectory(filePath)) {
99+
// Use relative path to avoid filtering out workspaces under hidden parent directories
100+
if (isPathInIgnoredDirectory(relativeFilePath)) {
100101
return false
101102
}
102103

0 commit comments

Comments
 (0)