Skip to content

Plan: Add Find in Files (Ctrl+Shift+F) #40

Description

@sbaker

Overview

Add workspace-wide text search as a sidebar panel, following existing panel architecture. All patterns and integration points already exist in the codebase.

Steps

  1. Add hotkey definition — Add findInFiles: { key: 'f', ctrl: true, shift: true } to DEFAULT_HOTKEYS in frontend/src/modules/types/hotkeys.ts

  2. Extend SidebarPanel type — Add 'find' to the SidebarPanel union in frontend/src/stores/types.ts

  3. Register hotkey handler — In frontend/src/modules/editor/PrompdEditor.tsx registerMonacoHotkeys(), intercept Ctrl+Shift+F and dispatch toggle-sidebar event with detail 'find'

  4. Add Activity Bar button — Add a Search icon (lucide-react) to frontend/src/modules/editor/ActivityBar.tsx following existing button pattern

  5. Create FindInFilesPanel component — New file frontend/src/modules/editor/FindInFilesPanel.tsx:

    • Search input with debounced query
    • Results grouped by file with line number previews
    • Click handler opens file + jumps to line via onOpenFile() + setJumpTo()
    • Keyboard navigation (arrow keys, Enter) following CommandPalette pattern
  6. Wire panel into App.tsx — Add conditional render block at ~line 4243 using existing visibility/position/pointerEvents pattern

  7. Add IPC search handler — Add fs:searchInFiles IPC handler in frontend/electron/main.js that searches in the main process (avoids hundreds of individual IPC round-trips). Takes query + directory + file patterns, returns grouped results with line numbers.

  8. File filtering — Search .prmd, .pdflow, .md, .json, .yaml, .ts, .tsx, .js by default. Exclude node_modules/, .git/, dist/. Respect .prompdignore if present. Configurable include/exclude globs in the search UI.

Key Files

File Role
frontend/src/modules/types/hotkeys.ts Hotkey definitions
frontend/src/stores/types.ts SidebarPanel type
frontend/src/modules/editor/PrompdEditor.tsx Hotkey registration
frontend/src/modules/editor/ActivityBar.tsx Sidebar buttons
frontend/src/modules/App.tsx (~line 4243) Panel rendering
frontend/electron/main.js IPC handlers
frontend/electron/preload.js IPC bridge

Reference Patterns

  • Panel architecture: FileExplorer, GitPanel (sidebar panels)
  • Search UI: RegistrySearchOverlay.tsx, CommandPalette.tsx
  • File opening: onOpenFile() in App.tsx (~line 1055)

Estimate

~1 new file, ~6 files modified. Medium complexity.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions