Fix @ to show all files using wildcard query
- Use '.' as query instead of empty string for @ mention - Fuzzy search matches all files with '.' pattern - Filter out directories (paths ending with /) - Shows git files + all project files when typing @
This commit is contained in:
@@ -100,8 +100,21 @@ const FilePicker: Component<FilePickerProps> = (props) => {
|
|||||||
isGitFile: false,
|
isGitFile: false,
|
||||||
}))
|
}))
|
||||||
} else {
|
} else {
|
||||||
console.log(`[FilePicker] Empty query, showing only git files`)
|
console.log(`[FilePicker] Empty query, fetching all files with wildcard`)
|
||||||
searchFiles = []
|
const searchResponse = await props.instanceClient.find.files({
|
||||||
|
query: { query: "." },
|
||||||
|
})
|
||||||
|
const elapsed = Date.now() - startTime
|
||||||
|
|
||||||
|
console.log(`[FilePicker] All files response received in ${elapsed}ms:`, searchResponse)
|
||||||
|
|
||||||
|
searchFiles = (searchResponse?.data || [])
|
||||||
|
.filter((path: string) => !path.endsWith("/"))
|
||||||
|
.filter((path: string) => !gitFiles.some((gf) => gf.path === path))
|
||||||
|
.map((path: string) => ({
|
||||||
|
path,
|
||||||
|
isGitFile: false,
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
const filteredGitFiles = searchQuery.trim()
|
const filteredGitFiles = searchQuery.trim()
|
||||||
|
|||||||
Reference in New Issue
Block a user