Implement client-side file scanning via Electron IPC with gitignore

- Add fs:scanDirectory IPC handler in main process
- Scan workspace recursively with proper gitignore support
- Use 'ignore' library for accurate gitignore pattern matching
- Expose scanDirectory via electronAPI in preload
- Call IPC from renderer instead of direct fs access
- Cache scanned files for fast filtering
- Scroll to top and highlight first item on results update
- Always exclude .git and node_modules directories
This commit is contained in:
Shantur Rathore
2025-10-24 10:10:12 +01:00
parent 6dcdd8294d
commit 1903bea1c8
4 changed files with 64 additions and 83 deletions

View File

@@ -14,6 +14,7 @@ export interface ElectronAPI {
}) => void,
) => void
onNewInstance: (callback: () => void) => void
scanDirectory: (workspaceFolder: string) => Promise<string[]>
}
const electronAPI: ElectronAPI = {
@@ -35,6 +36,7 @@ const electronAPI: ElectronAPI = {
onNewInstance: (callback) => {
ipcRenderer.on("menu:newInstance", () => callback())
},
scanDirectory: (workspaceFolder: string) => ipcRenderer.invoke("fs:scanDirectory", workspaceFolder),
}
contextBridge.exposeInMainWorld("electronAPI", electronAPI)