diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-06 10:10:16 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-06 10:10:16 +0000 |
commit | d75577fcee79aac06bdddb01fde431f26432c36c (patch) | |
tree | 693a4d4c970cbc88feed6dbadd0656a04449242e /crates/ra_assists/src/handlers | |
parent | 670895a49c271751bf275f0ca1303a1bca7aad5a (diff) | |
parent | 0ff8c55246d242af2f2fc4f88e67395320d00865 (diff) |
Merge #3483
3483: Unfold groups with single assists into plain assists r=matklad a=SomeoneToIgnore
A follow-up of https://github.com/rust-analyzer/rust-analyzer/pull/3120/files#r378788698 , made to show more detailed label when the assist group contains a single element
Co-authored-by: Kirill Bulatov <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/handlers')
-rw-r--r-- | crates/ra_assists/src/handlers/auto_import.rs | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/crates/ra_assists/src/handlers/auto_import.rs b/crates/ra_assists/src/handlers/auto_import.rs index c8bf181f9..4b62aac48 100644 --- a/crates/ra_assists/src/handlers/auto_import.rs +++ b/crates/ra_assists/src/handlers/auto_import.rs | |||
@@ -42,12 +42,7 @@ pub(crate) fn auto_import(ctx: AssistCtx) -> Option<Assist> { | |||
42 | return None; | 42 | return None; |
43 | } | 43 | } |
44 | 44 | ||
45 | let assist_group_name = if proposed_imports.len() == 1 { | 45 | let mut group = ctx.add_assist_group(auto_import_assets.get_import_group_message()); |
46 | format!("Import `{}`", proposed_imports.iter().next().unwrap()) | ||
47 | } else { | ||
48 | auto_import_assets.get_import_group_message() | ||
49 | }; | ||
50 | let mut group = ctx.add_assist_group(assist_group_name); | ||
51 | for import in proposed_imports { | 46 | for import in proposed_imports { |
52 | group.add_assist(AssistId("auto_import"), format!("Import `{}`", &import), |edit| { | 47 | group.add_assist(AssistId("auto_import"), format!("Import `{}`", &import), |edit| { |
53 | edit.target(auto_import_assets.syntax_under_caret.text_range()); | 48 | edit.target(auto_import_assets.syntax_under_caret.text_range()); |