@@ -534,10 +534,18 @@ impl VimCompleteItem {
534534 let abbr = lspitem. label . clone ( ) ;
535535
536536 let word = lspitem. insert_text . clone ( ) . unwrap_or_else ( || {
537+ if lspitem. insert_text_format == Some ( InsertTextFormat :: Snippet )
538+ || lspitem
539+ . text_edit
540+ . as_ref ( )
541+ . map ( |text_edit| text_edit. new_text . is_empty ( ) )
542+ . unwrap_or ( true )
543+ {
544+ return lspitem. label . clone ( ) ;
545+ }
546+
537547 match ( lspitem. text_edit . clone ( ) , complete_position) {
538- ( Some ( ref text_edit) , Some ( complete_position) )
539- if !text_edit. new_text . is_empty ( ) =>
540- {
548+ ( Some ( ref text_edit) , Some ( complete_position) ) => {
541549 // TextEdit range start might be different from vim expected completion start.
542550 // From spec, TextEdit can only span one line, i.e., the current line.
543551 if text_edit. range . start . character != complete_position {
@@ -550,9 +558,7 @@ impl VimCompleteItem {
550558 text_edit. new_text . clone ( )
551559 }
552560 }
553- ( Some ( ref text_edit) , _) if !text_edit. new_text . is_empty ( ) => {
554- text_edit. new_text . clone ( )
555- }
561+ ( Some ( ref text_edit) , _) => text_edit. new_text . clone ( ) ,
556562 ( _, _) => lspitem. label . clone ( ) ,
557563 }
558564 } ) ;
0 commit comments