@ -3950,7 +3950,6 @@ pub fn completion(cx: &mut Context) {
iter . reverse ( ) ;
iter . reverse ( ) ;
let offset = iter . take_while ( | ch | chars ::char_is_word ( * ch ) ) . count ( ) ;
let offset = iter . take_while ( | ch | chars ::char_is_word ( * ch ) ) . count ( ) ;
let start_offset = cursor . saturating_sub ( offset ) ;
let start_offset = cursor . saturating_sub ( offset ) ;
let prefix = text . slice ( start_offset .. cursor ) . to_string ( ) ;
cx . callback (
cx . callback (
future ,
future ,
@ -3960,7 +3959,7 @@ pub fn completion(cx: &mut Context) {
return ;
return ;
}
}
let mut items = match response {
let items = match response {
Some ( lsp ::CompletionResponse ::Array ( items ) ) = > items ,
Some ( lsp ::CompletionResponse ::Array ( items ) ) = > items ,
// TODO: do something with is_incomplete
// TODO: do something with is_incomplete
Some ( lsp ::CompletionResponse ::List ( lsp ::CompletionList {
Some ( lsp ::CompletionResponse ::List ( lsp ::CompletionList {
@ -3970,15 +3969,6 @@ pub fn completion(cx: &mut Context) {
None = > Vec ::new ( ) ,
None = > Vec ::new ( ) ,
} ;
} ;
if ! prefix . is_empty ( ) {
items . retain ( | item | {
item . filter_text
. as_ref ( )
. unwrap_or ( & item . label )
. starts_with ( & prefix )
} ) ;
}
if items . is_empty ( ) {
if items . is_empty ( ) {
// editor.set_error("No completion available");
// editor.set_error("No completion available");
return ;
return ;