@@ -47,7 +47,9 @@ impl CompletionScore<'_> {
4747 fn check_matches_query_input ( & mut self , ctx : & TreesitterContext ) {
4848 let content = match ctx. get_node_under_cursor_content ( ) {
4949 Some ( c) if !sanitization:: is_sanitized_token ( c. as_str ( ) ) => c. replace ( '"' , "" ) ,
50- _ => return ,
50+ _ => {
51+ return ;
52+ }
5153 } ;
5254
5355 let name = match self . data {
@@ -59,31 +61,28 @@ impl CompletionScore<'_> {
5961 CompletionRelevanceData :: Role ( r) => r. name . as_str ( ) . to_ascii_lowercase ( ) ,
6062 } ;
6163
62- let is_case =
63- matches ! ( self . data, CompletionRelevanceData :: Column ( _) ) && content. as_str ( ) == "u" ;
64-
6564 let fz_matcher = SkimMatcherV2 :: default ( ) ;
6665
6766 let check_against = match & ctx. identifier_qualifiers {
6867 // If both qualifiers are already written out, we must check the item's name itself.
69- ( Some ( _) , Some ( _) ) => name,
68+ ( Some ( _) , Some ( _) ) => name. clone ( ) ,
7069
7170 // If only one qualifier is written out, we might look at a schema, a table, or an alias.
7271 ( None , Some ( qualifier) ) => {
7372 if self . get_schema_name ( ) . is_some_and ( |s| s == qualifier) {
7473 self . get_table_name ( )
7574 . map ( |t| format ! ( "{}.{}" , t, name) )
76- . unwrap_or ( name)
75+ . unwrap_or ( name. clone ( ) )
7776 } else if self . get_table_name ( ) . is_some_and ( |t| t == qualifier) {
78- name
77+ name. clone ( )
7978 } else if ctx
8079 . get_mentioned_table_for_alias ( & qualifier)
8180 . is_some_and ( |alias_tbl| {
8281 self . get_table_name ( )
8382 . is_some_and ( |item_tbl| alias_tbl == item_tbl)
8483 } )
8584 {
86- name
85+ name. clone ( )
8786 } else {
8887 // the qualifier does not match schema, table, or alias.
8988 // what the hell is it?
@@ -102,10 +101,6 @@ impl CompletionScore<'_> {
102101 content. to_ascii_lowercase ( ) . as_str ( ) ,
103102 ) {
104103 Some ( score) => {
105- if is_case {
106- println ! ( "check {}, score {}" , check_against, score) ;
107- }
108-
109104 let scorei32: i32 = score
110105 . try_into ( )
111106 . expect ( "The length of the input exceeds i32 capacity" ) ;
@@ -116,7 +111,11 @@ impl CompletionScore<'_> {
116111 // - item: numeric_uplus, input: n, score: 31
117112 // - item: settings, input: sett, score: 91
118113 // - item: user_settings, input: sett, score: 82
119- self . score += scorei32 / 2 ;
114+ self . score += if check_against == name {
115+ scorei32 / 2
116+ } else {
117+ scorei32 / 3
118+ } ;
120119 }
121120 None => self . skip = true ,
122121 }
0 commit comments