Commit 489b41f
authored
feat: use fuze for file grep when using @ (#507)
### TL;DR
Improved file suggestion search with better matching and increased result limits.
closes #505
### What changed?
- Increased file display limit from 5 to 25 files
- Added a separate file fetch limit of 100 to retrieve more potential matches
- Implemented a dedicated fuzzy search for files using Fuse.js with appropriate weighting
- Added sorting logic to prioritize files that start with the query string
- Renamed `FUSE_OPTIONS` to `COMMAND_FUSE_OPTIONS` for clarity
- Created a new `FileItem` interface to better structure file data
### How to test?
1. Open the message editor
2. Type a file reference (e.g., `@file:`)
3. Enter search terms and verify:
- Up to 25 results are displayed (instead of 5)
- Results are properly sorted with exact matches first
- Fuzzy matching works correctly for partial file names
### Why make this change?
The previous implementation limited file suggestions to only 5 results and lacked sophisticated search capabilities. This change enhances the user experience by providing more relevant file suggestions through improved search algorithms and displaying a more useful number of results.1 parent f38fcf3 commit 489b41f
File tree
1 file changed
+50
-7
lines changed- apps/array/src/renderer/features/message-editor/suggestions
1 file changed
+50
-7
lines changedLines changed: 50 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
21 | 36 | | |
22 | 37 | | |
23 | 38 | | |
| |||
26 | 41 | | |
27 | 42 | | |
28 | 43 | | |
29 | | - | |
| 44 | + | |
30 | 45 | | |
31 | 46 | | |
32 | 47 | | |
| |||
42 | 57 | | |
43 | 58 | | |
44 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
45 | 81 | | |
46 | 82 | | |
47 | 83 | | |
| |||
55 | 91 | | |
56 | 92 | | |
57 | 93 | | |
58 | | - | |
| 94 | + | |
59 | 95 | | |
60 | 96 | | |
61 | | - | |
| 97 | + | |
62 | 98 | | |
63 | 99 | | |
64 | 100 | | |
65 | 101 | | |
66 | 102 | | |
67 | | - | |
68 | | - | |
69 | 103 | | |
| 104 | + | |
70 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
71 | 114 | | |
72 | 115 | | |
73 | 116 | | |
| |||
0 commit comments