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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user