Skip to content

Commit 75f81fd

Browse files
committed
Implement alphanumeric fuzzy matching to improve file search results in the @ quick pick menu
1 parent ef32739 commit 75f81fd

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎packages/vscode/src/views/panel/backend/message-handlers/handle-at-sign-quick-pick.ts‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,16 @@ const at_sign_quick_pick = async (params: {
5757
const filtered_items = all_quick_pick_items.filter((item) => {
5858
const search_lower = params.search_value!.toLowerCase()
5959
const filename_lower = item.label.toLowerCase()
60-
return filename_lower.includes(search_lower)
60+
61+
if (filename_lower.includes(search_lower)) {
62+
return true
63+
}
64+
65+
// This allows "pagetsx" to match "HomePage.tsx"
66+
const filename_alphanumeric = filename_lower.replace(/[^a-z0-9]/g, '')
67+
const search_alphanumeric = search_lower.replace(/[^a-z0-9]/g, '')
68+
69+
return filename_alphanumeric.includes(search_alphanumeric)
6170
})
6271

6372
if (filtered_items.length == 1) {

0 commit comments

Comments
 (0)