feat(desktop): Quick Open parity and file icons for chat @ mentions
Merged
HA
24d ago+303+303+012345678901234567890123456789-68-68-01234567890123456789
Links
- Issue: SUPER-2963
- Supersedes #8986. That PR went stale against main, which already had icons in the @ file rows. This PR carries over its parity work, plus a fix for a regression found while checking it in the app.
Summary
- Chat
@file mentions now load like Quick Open (Cmd+P): recently viewed files first, open files first among those, the same 50-result limit, and route paths likeroutes/$workspaceId/...stay searchable. - File icons now show where they were missing: file chips in sent messages, and pasted file URLs (no longer a globe). Pages and Chats rows in the
@menu now show the Paradev icon, as their link unfurls do.
Why / Context
The ticket asks whether @ loads files differently from Cmd+P (it did) and asks for extension icons in both the @ list and the link unfurl UI. Both surfaces already used the same host filesystem.searchFiles. The differences were all in the renderer:
- bare
@showed no files - recent files were not ranked first
- the limit was 20, not 50
- the
@token stopped at$ ( ) [ ] + ~, so route paths closed the menu partway through
How It Works
- Shared recent ordering.
matchRecentFiles(inuseRecentlyViewedFiles/utils) is now used by bothCommandPaletteand the@provider (fileMentionMatches). It puts open files first, filters by the query, then caps the list atRECENT_DISPLAY_LIMIT. Filtering before the cap is a small change for Quick Open too: a matching recent file older than the newest ten now shows. - Open file paths. ChatPane builds a
getOpenFilePathsgetter over the same store Quick Open reads: the right pane when it's enabled, otherwise the chat's own store. It reaches the Composer throughChatPaneActions, the same wayopenLinkdoes.openFilePathsInis shared withuseWorkspaceFileNavigation. - Stable search provider.
searchFilesreads recent files from the collection and open file paths through a getter when it runs. It does not subscribe to them. A subscription to the workspace's local-state row re-rendered every chat Composer on pane focus, resize and tab switches, because that row also holds the pane layout. It also gave the providers a new identity, which restarted the open menu's search, so slow searches (1–2 s for path queries) never landed. A failed search keeps the recent matches. A draft chat (agent starting or attaching) gets the open-file getter too. matchToken(chat-ui). The query may now contain$ ( ) [ ] + ~. A)or]that the token did not open still ends the query, so(cc @alice)andsee #general]behave as before. This applies to every trigger.- Icons. All icons come from the resolvers link unfurls already use:
- Files:
FileIcon/getFileIcon - Pages and Chats:
PluginIcon/getPluginIconUrl("superset")
- Files:
Manual QA
Done in the desktop dev app over CDP, with real X keyboard input (xdotool) in a local workspace on /workspace. The same script ran first with the changes stashed (main) and then with them applied.
| Step | Before (main) | After |
|---|---|---|
Bare @ | No Files section | Recently viewed files listed (below Plugins, see limitations) |
@Composer | Search results | Same results, with the recently viewed Composer.tsx first |
@routes/$workspaceId/hooks | Menu closes (0 options) | 50 files, same list and order as Cmd+P |
@hooks/useChangeset | 20 results | 50 results, same as Cmd+P |
Pasted https://example.com/files/report.pdf in composer | Globe icon | PDF icon |
| Sent message with a file mention and a PDF URL | File chip has no icon; PDF has a globe | TypeScript icon; PDF icon |
(cc @Comp then ) | Menu closes | Menu closes |
@app/(group then ) | Menu closes at ( | Menu stays open |
Pages rows / Chats rows in @ | No icon | Paradev icon |
Open-files-first ordering: with matchToken.ts viewed most recently but closed, Cmd+P and a bare @ both list linkUnfurl.ts, Composer.tsx (open) before matchToken.ts.
Not checked in the app: a failed file search, and the draft-chat path. Both are small changes and I found no easy way to trigger them.
Testing
bun testfor the v2-workspace tree, CommandPalette and AgentComposer: 1135 passbun testinpackages/chat-ui: 84 passtsc --noEmitclean forapps/desktopandpackages/chat-uibiome checkclean on the touched files- No new user-facing strings, so no catalog changes
- New tests:
matchToken.test.ts(route characters, space, brackets it did not open)matchRecentFiles.test.ts(open-first ordering, filter before the cap)fileMentions.test.ts
Known Limitations
- With a bare
@, the Files section renders below the 14 plugin rows, so recent files need a scroll. That order comes from how chat-ui lays out the default list, which this PR leaves alone. - Recent files are read when the search runs. A file opened while the
@menu is already open appears on the next keystroke. @path searches can take several seconds to show results on a large repo. Main is about as slow on the same queries.- While a search loads, the menu shows the previous query's rows. This is existing chat-ui behaviour.
Summary by CodeRabbit
- New Features
- File mentions now include matching recent and currently open workspace files, with open files prioritized and duplicates excluded.
- File mention chips and page mentions display more appropriate file and app icons.
- Bug Fixes
- File searches skip blank queries, and mention matching better handles route paths and bracketed tokens.