-
Notifications
You must be signed in to change notification settings - Fork 139
Comments
feat: Implement .gitignore parsing for file listing and search, and...#982
feat: Implement .gitignore parsing for file listing and search, and... #982prath47 wants to merge 4 commits intogeneralaction:main from
.gitignore parsing for file listing and search, and... #982Conversation
... refactor file tree loading to be non-recursive and on-demand.
@prath47 is attempting to deploy a commit to the General Action Team on Vercel.
A member of the Team first needs to authorize it.
Greptile SummaryThis PR introduces lazy loading of file trees and Key Changes:
Issues Found:
Confidence Score: 3/5
|
| Filename | Overview |
|---|---|
| src/main/utils/gitIgnore.ts | New wrapper class for ignore package to handle .gitignore pattern matching |
| src/main/workers/fsListWorker.ts | Added non-recursive mode support - stops scanning subdirectories when recursive: false |
| src/main/services/fs/LocalFileSystem.ts | Integrated gitignore filtering into content search to skip ignored directories |
| src/main/services/fsIpc.ts | Added gitignore parsing to file search and made recursive default to true for backward compatibility |
| src/renderer/components/FileExplorer/FileTree.tsx | Implemented lazy loading with constructSubRoot helper and non-recursive file listing; removed node_modules from default excludes |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User expands directory] --> B{Node already loaded?}
B -->|Yes| C[Toggle expand state]
B -->|No| D[Call loadChildren]
D --> E[constructSubRoot with rootPath + nodePath]
E --> F[fsList with recursive: false]
F --> G[fsListWorker reads directory]
G --> H{recursive = false?}
H -->|Yes| I[Skip subdirectories deeper than root]
H -->|No| J[Traverse all subdirectories]
I --> K[Return immediate children only]
J --> K
K --> L[Prefix paths with node.path]
L --> M[Filter existing children from allFiles]
M --> N[Add newItems to allFiles]
N --> O[Mark node as isLoaded: true]
O --> C
P[File Search] --> Q[Read .gitignore from project root]
Q --> R[Create GitIgnoreParser]
R --> S[collectFiles traverses directories]
S --> T{Path matches gitignore?}
T -->|Yes| U[Skip directory/file]
T -->|No| V[Include in search results]
Last reviewed commit: 23284c5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10 files reviewed, 6 comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path construction uses string concatenation which may produce double separators or incorrect paths on Windows. The subRoot path could end up as /root//path if rootPath already ends with separator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path construction with string concatenation may fail with Windows paths or create double separators. Should use a path utility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filtering existing children before adding new ones could incorrectly remove other loaded subdirectories if they share a path prefix. For example, loading src/components would remove src/common entries if they were already loaded.
Additional Comments (1)
src/renderer/components/FileExplorer/FileTree.tsx
Missing import for path module which is now used in lines 420 and 433.
prath47
commented
Feb 19, 2026
will go through this review once more
arnestrickmann
commented
Feb 20, 2026
@prath47 alright
...struction with tests, and integrate `ignore` package for improved gitignore functionality.
prath47
commented
Feb 20, 2026
@arnestrickmann check this once
arnestrickmann
commented
Feb 20, 2026
@greptile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
12 files reviewed, 2 comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This filtering logic removes all existing files that start with the node path. If you load src/components, this would incorrectly remove src/common files if they were already loaded from a previous expansion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The worker doesn't have access to .gitignore parsing, so node_modules and other gitignored paths will still be traversed and filtered later. Consider passing gitignore patterns to the worker or reading .gitignore in the worker for better performance.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Uh oh!
There was an error while loading. Please reload this page.
fix: #974
This PR includes changes as:
Checks Performed:
@arnestrickmann please review it