core: keep file @mentions responsive on first search

This commit is contained in:
Shoubhit Dash 2026-03-25 21:37:50 +05:30
commit 0ca507fd00
3 changed files with 28 additions and 6 deletions

View file

@ -573,14 +573,17 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
const seen = new Set(open)
const pinned: AtOption[] = open.map((path) => ({ type: "file", path, display: path, recent: true }))
if (!query.trim()) return [...agents, ...pinned]
const pathy = /[./\\]/.test(query)
const paths = await files.searchFiles(query)
const fileOptions: AtOption[] = paths
.filter((path) => !seen.has(path))
.map((path) => ({ type: "file", path, display: path }))
if (pathy) return fileOptions
return [...agents, ...pinned, ...fileOptions]
},
key: atKey,
filterKeys: ["display"],
stale: false,
groupBy: (item) => {
if (item.type === "agent") return "agent"
if (item.recent) return "recent"