aboutsummaryrefslogtreecommitdiff
path: root/crates/assists/src/handlers/auto_import.rs
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2020-10-05 16:41:49 +0100
committerLukas Wirth <[email protected]>2020-10-05 16:41:49 +0100
commit86993310143c1347db6308a66c1f31a7a5644f56 (patch)
tree19154fee7049c1424ee3c043db12b5b6eb335963 /crates/assists/src/handlers/auto_import.rs
parent67e71619b95dc674c93bd11fb21b311bfc2fb95a (diff)
Make ImportPrefix a configuration option
Diffstat (limited to 'crates/assists/src/handlers/auto_import.rs')
-rw-r--r--crates/assists/src/handlers/auto_import.rs16
1 files changed, 10 insertions, 6 deletions
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 {
191 _ => Some(candidate), 191 _ => Some(candidate),
192 }) 192 })
193 .filter_map(|candidate| match candidate { 193 .filter_map(|candidate| match candidate {
194 Either::Left(module_def) => { 194 Either::Left(module_def) => self.module_with_name_to_import.find_use_path_prefixed(
195 self.module_with_name_to_import.find_use_path_prefixed(db, module_def) 195 db,
196 } 196 module_def,
197 Either::Right(macro_def) => { 197 ctx.config.insert_use.prefix_kind,
198 self.module_with_name_to_import.find_use_path_prefixed(db, macro_def) 198 ),
199 } 199 Either::Right(macro_def) => self.module_with_name_to_import.find_use_path_prefixed(
200 db,
201 macro_def,
202 ctx.config.insert_use.prefix_kind,
203 ),
200 }) 204 })
201 .filter(|use_path| !use_path.segments.is_empty()) 205 .filter(|use_path| !use_path.segments.is_empty())
202 .take(20) 206 .take(20)