File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -45,13 +45,26 @@ where
4545 view. clear ( ) ;
4646
4747 let matcher = SkimMatcherV2 :: default ( ) ;
48+ let query_words: Vec < & str > = query. split_whitespace ( ) . collect ( ) ;
49+
4850 let mut matches: Vec < ( i64 , String ) > = actions
4951 . iter ( )
5052 . filter_map ( |action| {
5153 let action_name = action. text . to_string ( ) ;
52- matcher
53- . fuzzy_match ( & action_name, query)
54- . map ( |score| ( score, action_name) )
54+
55+ if query_words. is_empty ( ) {
56+ return Some ( ( 0 , action_name) ) ;
57+ }
58+
59+ let mut total_score = 0i64 ;
60+ for word in & query_words {
61+ match matcher. fuzzy_match ( & action_name, word) {
62+ Some ( score) => total_score += score,
63+ None => return None ,
64+ }
65+ }
66+
67+ Some ( ( total_score, action_name) )
5568 } )
5669 . collect ( ) ;
5770
You can’t perform that action at this time.
0 commit comments