aboutsummaryrefslogtreecommitdiff
path: root/crates/assists/src/handlers/auto_import.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-09-14 11:12:08 +0100
committerGitHub <[email protected]>2020-09-14 11:12:08 +0100
commita61178d2186b8d9ca324231ab03368819be0ff6e (patch)
treec9169fd4a7a1dd40cd7cee9e41456a0e17fdbb09 /crates/assists/src/handlers/auto_import.rs
parent0d03fe6ef57d3956e92382e0e1f1a916015191cb (diff)
parentadc4c6b9d7fd91827c4cf383a1e95dc7e27138e0 (diff)
Merge #5985
5985: Make MergeBehaviour configurable r=jonas-schievink a=Veykril This should make the newly implemented `MergeBehaviour` for import insertion configurable as roughly outlined in https://github.com/rust-analyzer/rust-analyzer/pull/5935#issuecomment-685834257. For the config name and the like I just picked what came to mind so that might be up for bikeshedding. Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/assists/src/handlers/auto_import.rs')
-rw-r--r--crates/assists/src/handlers/auto_import.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/crates/assists/src/handlers/auto_import.rs b/crates/assists/src/handlers/auto_import.rs
index 66e819154..b5eb2c722 100644
--- a/crates/assists/src/handlers/auto_import.rs
+++ b/crates/assists/src/handlers/auto_import.rs
@@ -14,10 +14,7 @@ use syntax::{
14 SyntaxNode, 14 SyntaxNode,
15}; 15};
16 16
17use crate::{ 17use crate::{utils::insert_use, AssistContext, AssistId, AssistKind, Assists, GroupLabel};
18 utils::{insert_use, MergeBehaviour},
19 AssistContext, AssistId, AssistKind, Assists, GroupLabel,
20};
21 18
22// Assist: auto_import 19// Assist: auto_import
23// 20//
@@ -60,7 +57,7 @@ pub(crate) fn auto_import(acc: &mut Assists, ctx: &AssistContext) -> Option<()>
60 let new_syntax = insert_use( 57 let new_syntax = insert_use(
61 &scope, 58 &scope,
62 make::path_from_text(&import.to_string()), 59 make::path_from_text(&import.to_string()),
63 Some(MergeBehaviour::Full), 60 ctx.config.insert_use.merge,
64 ); 61 );
65 builder.replace(syntax.text_range(), new_syntax.to_string()) 62 builder.replace(syntax.text_range(), new_syntax.to_string())
66 }, 63 },