From 96fc01a30b88d95619b26fd96c58627dd54cb339 Mon Sep 17 00:00:00 2001 From: asv Date: Sat, 6 Mar 2021 13:02:26 +0200 Subject: Make group imports configurable --- crates/ide_assists/src/handlers/auto_import.rs | 3 +-- crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs | 2 +- crates/ide_assists/src/handlers/replace_qualified_name_with_use.rs | 2 +- crates/ide_assists/src/tests.rs | 1 + 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ide_assists') diff --git a/crates/ide_assists/src/handlers/auto_import.rs b/crates/ide_assists/src/handlers/auto_import.rs index dc38f90e9..1422224ac 100644 --- a/crates/ide_assists/src/handlers/auto_import.rs +++ b/crates/ide_assists/src/handlers/auto_import.rs @@ -99,8 +99,7 @@ pub(crate) fn auto_import(acc: &mut Assists, ctx: &AssistContext) -> Option<()> format!("Import `{}`", &import), range, |builder| { - let rewriter = - insert_use(&scope, mod_path_to_ast(&import), ctx.config.insert_use.merge); + let rewriter = insert_use(&scope, mod_path_to_ast(&import), ctx.config.insert_use); builder.rewrite(rewriter); }, ); diff --git a/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs index 5c7678b53..4f0422e96 100644 --- a/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs @@ -154,7 +154,7 @@ fn insert_import( mod_path.pop_segment(); mod_path.push_segment(variant_hir_name.clone()); let scope = ImportScope::find_insert_use_container(scope_node, &ctx.sema)?; - *rewriter += insert_use(&scope, mod_path_to_ast(&mod_path), ctx.config.insert_use.merge); + *rewriter += insert_use(&scope, mod_path_to_ast(&mod_path), ctx.config.insert_use); } Some(()) } diff --git a/crates/ide_assists/src/handlers/replace_qualified_name_with_use.rs b/crates/ide_assists/src/handlers/replace_qualified_name_with_use.rs index f3bc6cf39..55481af34 100644 --- a/crates/ide_assists/src/handlers/replace_qualified_name_with_use.rs +++ b/crates/ide_assists/src/handlers/replace_qualified_name_with_use.rs @@ -44,7 +44,7 @@ pub(crate) fn replace_qualified_name_with_use( let mut rewriter = SyntaxRewriter::default(); shorten_paths(&mut rewriter, syntax.clone(), &path); if let Some(ref import_scope) = ImportScope::from(syntax.clone()) { - rewriter += insert_use(import_scope, path, ctx.config.insert_use.merge); + rewriter += insert_use(import_scope, path, ctx.config.insert_use); builder.rewrite(rewriter); } }, diff --git a/crates/ide_assists/src/tests.rs b/crates/ide_assists/src/tests.rs index b7f616760..a7a923beb 100644 --- a/crates/ide_assists/src/tests.rs +++ b/crates/ide_assists/src/tests.rs @@ -23,6 +23,7 @@ pub(crate) const TEST_CONFIG: AssistConfig = AssistConfig { insert_use: InsertUseConfig { merge: Some(MergeBehavior::Full), prefix_kind: hir::PrefixKind::Plain, + group: true, }, }; -- cgit v1.2.3