Skip to content

Commit e6d0518

Browse files
committed
docs: add PR description file
1 parent d38a996 commit e6d0518

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

pr-description.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
## Description
2+
3+
Fixes #5655
4+
5+
This PR resolves three critical issues with codebase indexing file exclusion rules that were preventing .gitignore and .rooignore files from working correctly.
6+
7+
## Issues Fixed
8+
9+
### 1. .gitignore files have no effect on indexing
10+
11+
**Root Cause**: The manager was trying to read a single `.gitignore` file without checking existence, causing silent failures.
12+
13+
**Solution**: Replaced broken logic with proper use of `findGitignoreFiles()` function that walks up the directory tree to find all .gitignore files and loads patterns correctly.
14+
15+
### 2. .rooignore files only work after VSCode restart and are inconsistent
16+
17+
**Root Cause**: Each scan was creating new `RooIgnoreController` instances without file watchers, losing ignore patterns.
18+
19+
**Solution**: Created a global `RooIgnoreController` instance in the manager that is reused across all components, ensuring file watchers and patterns are preserved.
20+
21+
### 3. .rooignore rules are ignored after using 'Clear Index Data' until VSCode restart
22+
23+
**Root Cause**: Service recreation during "Clear Index Data" wasn't reloading ignore patterns.
24+
25+
**Solution**: Made `loadRooIgnore()` method public and ensured patterns are reloaded during service recreation.
26+
27+
## Changes Made
28+
29+
- **src/services/code-index/manager.ts**:
30+
31+
- Added global `_rooIgnoreController` instance
32+
- Fixed .gitignore loading to use `findGitignoreFiles()` instead of broken single-file logic
33+
- Added proper initialization and disposal of RooIgnoreController
34+
- Ensured patterns are reloaded during service recreation
35+
36+
- **src/core/ignore/RooIgnoreController.ts**:
37+
38+
- Made `loadRooIgnore()` method public for external reloading
39+
- Fixed `dispose()` method to handle undefined disposables safely
40+
41+
- **src/services/code-index/processors/scanner.ts**:
42+
43+
- Updated constructor to accept optional `RooIgnoreController` parameter
44+
- Modified logic to use injected controller instead of creating new instances
45+
46+
- **src/services/code-index/service-factory.ts**:
47+
48+
- Updated factory methods to accept and pass `RooIgnoreController`
49+
- Ensured global controller is used by both scanner and file watcher
50+
51+
- **src/services/glob/list-files.ts**:
52+
- Exported `findGitignoreFiles()` function for use in manager
53+
54+
## Testing
55+
56+
- **Added comprehensive integration tests** in `src/services/code-index/__tests__/ignore-integration.spec.ts` covering:
57+
58+
- .gitignore pattern loading and application
59+
- RooIgnoreController instance preservation across service recreations
60+
- Pattern reloading during service recreation
61+
- Integration between gitignore and rooignore controllers
62+
63+
- **Fixed existing test infrastructure**:
64+
65+
- Updated VSCode mocks to include `RelativePattern` and `createFileSystemWatcher`
66+
- Fixed test mocks to properly simulate initialized manager state
67+
68+
- **All tests passing**:
69+
- ✅ 5/5 new integration tests pass
70+
- ✅ 346/346 code-index tests pass (no regressions)
71+
- ✅ All linting and type checking passes
72+
73+
## Verification of Acceptance Criteria
74+
75+
- [x] **.gitignore files now have effect on indexing**: Fixed broken loading logic
76+
- [x] **.rooignore files work consistently without VSCode restart**: Global controller instance preserves patterns and file watchers
77+
- [x] **.rooignore rules persist after "Clear Index Data"**: Patterns are properly reloaded during service recreation
78+
- [x] **All existing functionality preserved**: No breaking changes, backward compatible
79+
- [x] **Comprehensive test coverage**: Integration tests verify all three issues are resolved
80+
81+
## Checklist
82+
83+
- [x] Code follows project style guidelines
84+
- [x] Self-review completed
85+
- [x] Comments added for complex logic
86+
- [x] No breaking changes
87+
- [x] All tests pass (346/346 code-index tests)
88+
- [x] Linting and type checking pass
89+
- [x] Integration tests added for all reported issues
90+
- [x] Backward compatibility maintained

0 commit comments

Comments
 (0)