Skip to content
Source
Sign inSign up
pingdotgg/t3code

Add project file picker (⌘P) and project content search (⇧⌘F) #4855

Mergedjakeleventhal(GitHub profile, opens in a new tab)merged 23 commits intomain fromrefs/pull/4855/headmerged by juliusmarminge View on GitHub

Summary

Screenshot 2026-07-29 at 12 35 08 PM Screenshot 2026-07-29 at 12 35 34 PM

Combines and supersedes #3985 and #4007, rebuilt from scratch against current main.

  • ⌘P file picker: fuzzy file search over the server-backed workspace index with matched-character highlighting; opens files through the same right-panel action as the Files sidebar
  • ⇧⌘F content search: VS Code-style project-wide text search with case-sensitive, whole-word, and regex options; syntax-highlighted result lines grouped by file; opens results at the matching line and reveals the file in the explorer
  • Both are modes of a single global search overlay alongside the ⌘K command palette

Why one PR

The two originals overlapped heavily (WorkspaceSearchIndex, WorkspaceEntries, keybindings, contracts, queries.ts) but made opposite hosting choices: #3985 put the file picker inside the command palette host while #4007 put content search inside ChatView with its own keydown handling and duplicated project resolution. This PR unifies them:

  • One reducer (reduceCommandPaletteUiState) owns open/mode state for all three overlays — they can never stack, re-pressing a mode's shortcut closes it, pressing a different one switches in place
  • One keydown dispatcher in the palette host handles commandPalette.toggle / filePicker.toggle / projectSearch.toggle
  • One shared useActiveProjectTarget() hook resolves the active thread/draft → project workspace for both surfaces; both open results via rightPanelStore.openFile(threadRef, path, line?)
  • ChatView needed zero changes (line reveal already existed on main)

Implementation

Server

  • WorkspaceSearchIndex.search accepts an optional kind filter and routes to fff fileSearch/directorySearch so file-only queries are filtered before truncation; all fff calls share one runSearch error wrapper
  • New searchContents backed by FileFinder.grep with a 250ms time budget; whole-word wrapping falls back to explicit non-word boundaries for punctuation-edged queries (e.g. foo-) in both literal and regex modes, and byte offsets are mapped to string indices for highlighting
  • Content indexing enabled for workspace indexes (disableContentIndexing: false)
  • New projects.searchContents RPC with orchestration read scope and structured errors that carry query length, never query text

Web

  • ProjectFilePicker preserves server ranking and computes subsequence highlight indices client-side with the same query normalization the server applies
  • ProjectContentSearchDialog state resets by unmount/keying instead of effects; regex-error and truncation states surfaced in the status line
  • Shared getSyntaxHighlighterPromise + RenderErrorBoundary extracted from ChatMarkdown; HighlightedSearchLine splits Shiki tokens around match ranges
  • FileBrowserPanel reveals/expands/selects the file open in the preview pane without echoing a synthetic open
  • useComposerPathSearch generalized to useProjectPathSearch (configurable limit + kind, debounce-aware pending state)

Command naming follows the existing toggle family: filePicker.toggle (mod+p) and projectSearch.toggle (mod+shift+f), both documented in docs/user/keybindings.md.

Validation

  • vp run typecheck — passes workspace-wide
  • vp check — 0 errors; one fewer lint warning than main
  • Full apps/web suite: 188 files / 1,676 tests; contracts + shared + client-runtime: 1,006 tests
  • Server workspace tests run against the real fff grep engine, including cases the originals lacked: directory-kind filtering and multi-byte (héllo wörld) range mapping, plus the ported gitignore, case-sensitivity, truncation, and punctuation whole-word regressions
  • Manually verified in a local dev environment

Closes #3985. Closes #4007.

🤖 Generated with Claude Code


Note

Medium Risk New workspace content index and grep path add server CPU/memory and search correctness surface (whole-word, regex, multi-byte ranges). Overlay and file-reveal logic are broad UI changes; keybinding backfill fix is low-risk but touches persisted config.

Overview Adds ⌘P file picker and ⇧⌘F project content search as modes of the same global overlay as ⌘K, with one reducer so modes cannot stack and re-pressing a shortcut toggles or switches mode.

Server: New projects.searchContents RPC and orchestration read auth; workspace indexes split into paths vs content keys (content indexing only for grep). Path search supports optional kind filtering and shared query normalization; content search uses FileFinder.grep with time budget, per-file match caps, and post-filter whole-word boundaries (Unicode-aware). Index warmup uses waitForIndexReady instead of polling isScanning. Default keybinding backfill no longer truncates user rules when at max entries.

Web: ProjectFilePicker and ProjectContentSearchDialog share CommandPaletteContent chrome; useActiveProjectTarget resolves workspace + thread for both. Results open via rightPanelStore.openFile with optional line reveal; file tree syncs selection/reveal without echo-opens. Shared getSyntaxHighlighterPromise and RenderErrorBoundary for search result highlighting. New defaults: filePicker.toggle (mod+p), projectSearch.toggle (mod+shift+f).

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1d4e0f33e7c10e0e02fe00c0af973231ceae1648. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add project file picker (⌘P) and project content search (⇧⌘F) to the command palette

  • Adds two new overlay modes to the command palette: a file picker (⌘P) that searches server-indexed project files with fuzzy highlighting, and a content search dialog (⇧⌘F) that searches file contents with case-sensitive, whole-word, and regex options with syntax-highlighted results.
  • Introduces SearchOverlayMode ('command' | 'files' | 'content') to the command palette state; pressing Escape in files or content mode returns to 'command' mode instead of closing the overlay.
  • Adds projects.searchContents WebSocket RPC backed by a new 'content' variant WorkspaceSearchIndex using FileFinder.grep with smart-case, whole-word Unicode filtering, time-budgeted pagination, and byte-to-string range mapping.
  • Extends ProjectSearchEntriesInput to allow empty queries (for frecency-ordered results) and an optional kind filter ('file' | 'directory'); adds ProjectSearchContentsInput/Result/Error contract types.
  • Syncs the file tree in FileBrowserPanel to reveal and center the file opened from the picker, with retry logic and scroll-guard in useFileLineReveal to prevent snap-back.
  • Risk: useHandleNewThread now spreads workspaceContext directly — if it is null or undefined at runtime the spread will throw, whereas previously it silently produced an empty object.
Macroscope summarized 1d4e0f3.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      This PR introduces two new user-facing features (⌘P file picker and ⇧⌘F content search) with new keybindings, RPC endpoints, UI components, and backend search functionality. New feature capabilities of this scope warrant human review.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. 💡 Codex Review

      Here are some automated review suggestions for this pull request.

      Reviewed commit: 6a16c6c293

      ℹ️ About Codex in GitHub

      Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

      • Open a pull request for review
      • Mark a draft as ready
      • Comment "@codex review".

      If Codex has suggestions, it will comment; otherwise it will react with 👍.

      Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

    4. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 892c62f3-f2e7-4cad-8132-22552fd29709

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    5. Pushed 0f7cceec addressing the review feedback:

      Server

      • Whole-word matching redesigned (cursor[bot] ×2, codex P2): the grep now runs on the bare pattern and match ranges are filtered by VS Code-style word boundaries afterwards. This fixes both the widened highlight spans (regex + whole-word) and adjacent occurrences being dropped by consuming (?:^|\W) boundaries, and it aligns whole-word semantics with VS Code. Covered by new adjacency, boundary, and regex-edge tests against the real grep engine.
      • maxMatchesPerFile capped at 100 (cursor[bot]) so one dense file can't fill the whole page — test included.
      • Content indexing is no longer enabled globally (codex P1): the workspace index map is now keyed by paths/content variant, so path-only consumers (file tree, composer search, file picker) keep the lightweight index and the content-capable index initializes only on first content search.
      • Startup keybinding backfill no longer evicts the user's oldest custom rules at MAX_KEYBINDINGS_COUNT (codex P2) — defaults that don't fit are skipped with a warning.

      Web

      • Explorer reveal expands ancestors using slash-terminated directory IDs (cursor[bot] High, codex P2), updates the drag controller's selection cache before the sync guard (macroscope), and skips the reveal when the selection originated inside the tree so an active tree search is preserved (codex P2).
      • Content search preserves query whitespace on the wire (macroscope) — the contract query is no longer trimmed; trimming is only used to detect blank input.
      • Enter is gated while a newer query is debouncing/in flight so stale results can't be opened (macroscope).
      • Result rows render in growing 100-row windows via a scroll sentinel instead of mounting all 500 syntax-highlighted rows at once (codex P2).
      • The ⌘P empty state now uses a bounded file-only server query (empty query = frecency-ordered recent files) instead of transferring the full workspace listing (codex P2).
      • The command palette gained explicit "Go to file" and "Search project contents" actions with their shortcut hints (codex P1), and the overlay shortcut listener resolves with the complete when-clause context including previewFocus/previewOpen (codex P2).
      • Re: mobile (codex P1): rather than adding a mobile surface, the unused mobile-facing wiring was removed — the content-search atom family moved out of the shared client-runtime project atoms into a web-only module, and the unconsumed EnvironmentApi.projects.searchContents interface method was dropped. Mobile support can be added deliberately in a follow-up.

      Also fixed a bug found in manual testing: opening a content-search result could land at the top of the file instead of the matched line. The line reveal now retries until file contents and line metrics are hydrated (previously an early post-render could clamp against empty contents, scroll to line 1, and mark the request handled) and briefly guards the target scroll position against late programmatic resets from the editable editor, cancelling on real user input.

      Validation: workspace typecheck clean, vp check 0 errors, full web suite (1,678 tests) plus server workspace/keybindings/contracts suites passing.

      🤖 Generated with Claude Code

    6. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      https://github.com/pingdotgg/t3code/blob/6fc40cb9f293f8cb3616ae27387f06d9e96b642c/apps/server/src/workspace/WorkspaceSearchIndex.ts#L337

      make waits only for finder.isScanning() to become false, but now that disableContentIndexing is false the index also has a content-index warmup phase that continues after the scan finishes. A searchContents call issued right after the layer is created runs against a partially warmed index and silently omits matches. Consider waiting for finder.waitForIndexReady (with the existing timeout/error mapping) instead of polling isScanning.

      No longer relevant as of ce9b3c107ed4b019e997a9bd475ce9a58d04bfec

    7. Agent: Done by waiting for FileFinder.waitForIndexReady so both scanning and content-index warmup complete before the index is exposed, with structured timeout/error handling and regression coverage: https://github.com/pingdotgg/t3code/commit/04c228b3da4d2a058f45f251c1ba30b155c63869

    8. Sorry, I'm unable to act on this request because you do not have permissions within this repository.

    9. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 051e31905e27d59400c6e8535fac2d317c0d85ae. Configure [here](https://www.cursor.com/dashboard/bugbot).
    10. juliusmarminge merged thisabc409c

    11. juliusmarminge closed this

Sign in to join this conversation.