-
Notifications
You must be signed in to change notification settings - Fork 5k
Description
Bug Report
Description
When searching for folders in the "Open Project" dialog, recent projects that appear in the home page are not included in search results.
For example, if I have a project at /Users/xxx/my-project that shows up in "Recent projects" on the home page, searching for "my-project" in the "Open Project" dialog shows "No folders found" instead of listing that project.
Expected Behavior
The "Open Project" dialog should search across all accessible directories, including recently opened projects. When I search for a project name that appears in the recent projects list, it should show up in the search results.
Current Behavior
The "Open Project" dialog only searches within the current project directory (via server-side fuzzy search). Recent projects stored in the database (sync.data.project) are completely excluded from search results, even though they appear on the home page.
Steps to Reproduce
- Open a project (e.g.,
~/my-project) - Go to home page - project appears in "Recent projects"
- Press
Cmd+O(or click "Open project") - Type "my-project" in the search box
- See "No folders found for 'my-project'" message
Root Cause
The backend File.search() function (in packages/opencode/src/file/index.ts:372-410) only searches files and directories within the current project directory using Ripgrep. It does not search across all projects.
Recent projects are stored in the database (sync.data.project.worktree) separately from the file system, so the server cannot find them. The frontend DialogSelectDirectory component needs to manually merge recent projects with server search results.
Related Code
- Frontend:
packages/app/src/components/dialog-select-directory.tsx - Backend search:
packages/opencode/src/file/index.ts:372-410(File.search()) - Server endpoint:
packages/opencode/src/server/server.ts:1924(/v2/files/find)
Proposed Fix
Merge recent projects with server search results in the frontend, allowing client-side fuzzy search (via fuzzysort) to match against both:
- Full paths:
/Users/xxx/my-project - Display paths:
~/my-project
This maintains the existing server-side fuzzy search behavior while including recently opened projects.
OpenCode Version
1.1.1 (dev)
Operating System
macOS (Darwin)