From 1536fc040ab83089afdbd9c1d94d277406ae1656 Mon Sep 17 00:00:00 2001 From: The0x539 Date: Fri, 4 Feb 2022 19:55:55 -0600 Subject: [PATCH] Fix trait impl completion ranges --- crates/ide_completion/src/completions/trait_impl.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/ide_completion/src/completions/trait_impl.rs b/crates/ide_completion/src/completions/trait_impl.rs index 7a42cfbd42e..4b1de8058de 100644 --- a/crates/ide_completion/src/completions/trait_impl.rs +++ b/crates/ide_completion/src/completions/trait_impl.rs @@ -145,10 +145,10 @@ fn add_function_impl( } else { CompletionItemKind::SymbolKind(SymbolKind::Function) }; - let mut item = CompletionItem::new(completion_kind, ctx.source_range(), label); - item.lookup_by(fn_name).set_documentation(func.docs(ctx.db)); let range = replacement_range(ctx, fn_def_node); + let mut item = CompletionItem::new(completion_kind, range, label); + item.lookup_by(fn_name).set_documentation(func.docs(ctx.db)); if let Some(source) = ctx.sema.source(func) { let assoc_item = ast::AssocItem::Fn(source.value); @@ -209,7 +209,7 @@ fn add_type_alias_impl( let snippet = format!("type {} = ", alias_name); let range = replacement_range(ctx, type_def_node); - let mut item = CompletionItem::new(SymbolKind::TypeAlias, ctx.source_range(), &snippet); + let mut item = CompletionItem::new(SymbolKind::TypeAlias, range, &snippet); item.text_edit(TextEdit::replace(range, snippet)) .lookup_by(alias_name) .set_documentation(type_alias.docs(ctx.db)); @@ -237,7 +237,7 @@ fn add_const_impl( let snippet = make_const_compl_syntax(&transformed_const); let range = replacement_range(ctx, const_def_node); - let mut item = CompletionItem::new(SymbolKind::Const, ctx.source_range(), &snippet); + let mut item = CompletionItem::new(SymbolKind::Const, range, &snippet); item.text_edit(TextEdit::replace(range, snippet)) .lookup_by(const_name) .set_documentation(const_.docs(ctx.db));