@@ -527,33 +527,15 @@ pub struct VimCompleteItemUserData {
527
527
528
528
impl VimCompleteItem {
529
529
pub fn from_lsp ( lspitem : & CompletionItem , complete_position : Option < u64 > ) -> Fallible < Self > {
530
+ info ! (
531
+ "LSP CompletionItem to VimCompleteItem: {:?}, {:?}" ,
532
+ lspitem, complete_position
533
+ ) ;
530
534
let abbr = lspitem. label . clone ( ) ;
531
- let mut word = lspitem. insert_text . clone ( ) . unwrap_or_default ( ) ;
532
- if word. is_empty ( ) {
533
- match ( lspitem. text_edit . clone ( ) , complete_position) {
534
- ( Some ( ref text_edit) , Some ( complete_position) )
535
- if !text_edit. new_text . is_empty ( ) =>
536
- {
537
- // TextEdit range start might be different from vim expected completion start.
538
- // From spec, TextEdit can only span one line, i.e., the current line.
539
- if text_edit. range . start . character != complete_position {
540
- word = text_edit
541
- . new_text
542
- . get ( ( complete_position as usize ) ..)
543
- . and_then ( |line| line. split_whitespace ( ) . next ( ) )
544
- . map_or_else ( String :: new, ToOwned :: to_owned) ;
545
- } else {
546
- word = text_edit. new_text . clone ( ) ;
547
- }
548
- }
549
- ( Some ( ref text_edit) , _) if !text_edit. new_text . is_empty ( ) => {
550
- word = text_edit. new_text . clone ( ) ;
551
- }
552
- ( _, _) => {
553
- word = lspitem. label . clone ( ) ;
554
- }
555
- }
556
- }
535
+ let word = lspitem
536
+ . insert_text
537
+ . clone ( )
538
+ . unwrap_or_else ( || lspitem. label . clone ( ) ) ;
557
539
558
540
let snippet;
559
541
if lspitem. insert_text_format == Some ( InsertTextFormat :: Snippet ) {
0 commit comments