From 86993310143c1347db6308a66c1f31a7a5644f56 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 5 Oct 2020 17:41:49 +0200 Subject: Make ImportPrefix a configuration option --- crates/assists/src/handlers/auto_import.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'crates/assists/src/handlers/auto_import.rs') diff --git a/crates/assists/src/handlers/auto_import.rs b/crates/assists/src/handlers/auto_import.rs index fa524ffd9..357ff6392 100644 --- a/crates/assists/src/handlers/auto_import.rs +++ b/crates/assists/src/handlers/auto_import.rs @@ -191,12 +191,16 @@ impl AutoImportAssets { _ => Some(candidate), }) .filter_map(|candidate| match candidate { - Either::Left(module_def) => { - self.module_with_name_to_import.find_use_path_prefixed(db, module_def) - } - Either::Right(macro_def) => { - self.module_with_name_to_import.find_use_path_prefixed(db, macro_def) - } + Either::Left(module_def) => self.module_with_name_to_import.find_use_path_prefixed( + db, + module_def, + ctx.config.insert_use.prefix_kind, + ), + Either::Right(macro_def) => self.module_with_name_to_import.find_use_path_prefixed( + db, + macro_def, + ctx.config.insert_use.prefix_kind, + ), }) .filter(|use_path| !use_path.segments.is_empty()) .take(20) -- cgit v1.2.3