From 0e050fc3eba251f3debf964c7779c522e5639cd8 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 10 Nov 2020 23:40:07 +0200 Subject: Allow to configure the merge behavior --- crates/completion/src/completions/complete_magic.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'crates/completion/src/completions') diff --git a/crates/completion/src/completions/complete_magic.rs b/crates/completion/src/completions/complete_magic.rs index 4cf21e19d..58509fc5b 100644 --- a/crates/completion/src/completions/complete_magic.rs +++ b/crates/completion/src/completions/complete_magic.rs @@ -1,6 +1,6 @@ //! TODO kb move this into the complete_unqualified_path when starts to work properly -use assists::utils::{insert_use, mod_path_to_ast, ImportScope, MergeBehaviour}; +use assists::utils::{insert_use, mod_path_to_ast, ImportScope}; use either::Either; use hir::{db::HirDatabase, MacroDef, ModuleDef, Query}; use itertools::Itertools; @@ -48,10 +48,7 @@ pub(crate) fn complete_magic(acc: &mut Completions, ctx: &CompletionContext) -> ); builder.replace(anchor.syntax().text_range(), correct_qualifier); - // TODO kb: assists already have the merge behaviour setting, need to unite both - // also consider a settings toggle for this particular feature? - let rewriter = - insert_use(&import_scope, mod_path_to_ast(&mod_path), Some(MergeBehaviour::Full)); + let rewriter = insert_use(&import_scope, mod_path_to_ast(&mod_path), ctx.config.merge); let old_ast = rewriter.rewrite_root()?; algo::diff(&old_ast, &rewriter.rewrite(&old_ast)).into_text_edit(&mut builder); -- cgit v1.2.3