fix(app): show directories in web project picker on open - #39758
Closed
mdatla wants to merge 2 commits into
Closed
Conversation
The web directory picker always rendered "No folders found" on a fresh browser profile, making it impossible to add a first project: 1. An empty filter was sent to fuzzy find (/find/file), which returns no results for an empty query and additionally refuses to index $HOME or filesystem roots, where the picker bases itself on headless servers. 2. The browse call (file.list) omitted the required path query param, so the server answered HTTP 400 and the error was swallowed. Browse directories via file.list (with path: "") when the filter is empty, and keep fuzzy find for typed non-empty filters. Fixes anomalyco#39434 Fixes anomalyco#37961 Fixes anomalyco#37611
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Found potential duplicates:
Why these are potentially related: These PRs all address issues with the web project picker not showing directories/folders on initial open or when the project is empty. PR #37612 is particularly relevant since it targets the same symptom (empty folder listing in picker). Your PR #39758 explicitly closes issues #39434, #37961, and #37611 — one of which (#37611) may be connected to #37612. |
6 tasks
3 tasks
|
Fixed in #41158. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #39434
Closes #37961
Closes #37611
Type of change
What does this PR do?
The web directory picker ("Open project") always shows "No folders found" on a fresh browser profile, so there is no way to add a first project in
opencode web/opencode serve. Two independent causes increateDirectorySearch:/find/file). Fuzzy find returns nothing for an empty query, and fff additionally refuses to index$HOME/ filesystem roots — which is where the picker bases itself (sync.data.path.home) on headless servers. Result: the picker always opens empty.file.list({ location: { directory } })omits thepathquery param, which the server requires (FileListData.query.path: string). The server answersHTTP 400 "Missing key at [\"path\"]"and the.catch(() => [])swallows it. This also breaks the commonly suggested workaround of typing a path into the picker on current versions.Fix: pass
path: ""tofile.list, and route empty filters to directory browse (match(directory, "", 50)) instead of fuzzy find. Typed non-empty filters still use/find/file— unchanged.How did you verify your code works?
opencode serve1.18.9 instance:GET /file?directory=<dir>→ HTTP 400; the same request withpath=→ 200 with the full directory listing.file.list(assertspath: ""is sent andfile.findis not called); a typed filter still uses fuzzy find.bun run test:unit(packages/app): 694 pass / 1 fail — the failure isi18n parity, which also fails on pristinedev(pre-existing, unrelated).bun run typecheck: clean.Screenshots / recordings
None attached — verified at the API level (curl repro above) and with unit tests. Happy to record the picker if a maintainer wants one.
Checklist
Two notes: