File tree 2 files changed +11
-5
lines changed
2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,10 @@ pub fn fuzzy(
56
56
opts : FuzzyOptions ,
57
57
) -> Vec < usize > {
58
58
let nearby_words: HashSet < String > = HashSet :: from_iter ( opts. nearby_words . unwrap_or_default ( ) ) ;
59
- let haystack_labels = haystack. iter ( ) . map ( |s| s. label . clone ( ) ) . collect :: < Vec < _ > > ( ) ;
59
+ let haystack_labels = haystack
60
+ . iter ( )
61
+ . map ( |s| s. filter_text . clone ( ) . unwrap_or ( s. label . clone ( ) ) )
62
+ . collect :: < Vec < _ > > ( ) ;
60
63
61
64
// Fuzzy match with fzrs
62
65
let options = frizbee:: Options {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use mlua::prelude::*;
3
3
#[ derive( Debug ) ]
4
4
pub struct LspItem {
5
5
pub label : String ,
6
+ pub filter_text : Option < String > ,
6
7
pub kind : u32 ,
7
8
pub score_offset : i32 ,
8
9
pub source_id : String ,
@@ -11,13 +12,15 @@ pub struct LspItem {
11
12
impl FromLua for LspItem {
12
13
fn from_lua ( value : LuaValue , _: & Lua ) -> LuaResult < Self > {
13
14
if let Some ( tab) = value. as_table ( ) {
14
- let label: String = tab. get ( "label" ) . unwrap_or_default ( ) ;
15
- let kind: u32 = tab. get ( "kind" ) . unwrap_or_default ( ) ;
16
- let score_offset: i32 = tab. get ( "score_offset" ) . unwrap_or ( 0 ) ;
17
- let source_id: String = tab. get ( "source_id" ) . unwrap_or_default ( ) ;
15
+ let label = tab. get ( "label" ) . unwrap_or_default ( ) ;
16
+ let filter_text = tab. get ( "filter_text" ) . ok ( ) ;
17
+ let kind = tab. get ( "kind" ) . unwrap_or_default ( ) ;
18
+ let score_offset = tab. get ( "score_offset" ) . unwrap_or ( 0 ) ;
19
+ let source_id = tab. get ( "source_id" ) . unwrap_or_default ( ) ;
18
20
19
21
Ok ( LspItem {
20
22
label,
23
+ filter_text,
21
24
kind,
22
25
score_offset,
23
26
source_id,
You can’t perform that action at this time.
0 commit comments