Skip to content

Commit 21782b9

Browse files
committed
minor: Group extract_function with other extraction assists
1 parent 0cad614 commit 21782b9

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

crates/ide-assists/src/handlers/extract_function.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use hir::{
77
TypeInfo, TypeParam,
88
};
99
use ide_db::{
10+
assists::GroupLabel,
1011
defs::{Definition, NameRefClass},
1112
famous_defs::FamousDefs,
1213
helpers::mod_path_to_ast,
@@ -104,7 +105,8 @@ pub(crate) fn extract_function(acc: &mut Assists, ctx: &AssistContext<'_>) -> Op
104105

105106
let scope = ImportScope::find_insert_use_container(&node, &ctx.sema)?;
106107

107-
acc.add(
108+
acc.add_group(
109+
&GroupLabel("Extract into...".to_owned()),
108110
AssistId("extract_function", crate::AssistKind::RefactorExtract),
109111
"Extract into function",
110112
target_range,

crates/ide-assists/src/tests.rs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ pub fn test_some_range(a: int) -> bool {
363363
expect![[r#"
364364
Convert integer base
365365
Extract into...
366-
Extract into function
367366
Replace if let with match
368367
"#]]
369368
.assert_eq(&expected);
@@ -392,7 +391,6 @@ pub fn test_some_range(a: int) -> bool {
392391
expect![[r#"
393392
Convert integer base
394393
Extract into...
395-
Extract into function
396394
Replace if let with match
397395
"#]]
398396
.assert_eq(&expected);
@@ -406,7 +404,6 @@ pub fn test_some_range(a: int) -> bool {
406404

407405
expect![[r#"
408406
Extract into...
409-
Extract into function
410407
"#]]
411408
.assert_eq(&expected);
412409
}
@@ -511,7 +508,11 @@ pub fn test_some_range(a: int) -> bool {
511508
RefactorExtract,
512509
),
513510
label: "Extract into function",
514-
group: None,
511+
group: Some(
512+
GroupLabel(
513+
"Extract into...",
514+
),
515+
),
515516
target: 59..60,
516517
source_change: None,
517518
command: None,
@@ -601,7 +602,11 @@ pub fn test_some_range(a: int) -> bool {
601602
RefactorExtract,
602603
),
603604
label: "Extract into function",
604-
group: None,
605+
group: Some(
606+
GroupLabel(
607+
"Extract into...",
608+
),
609+
),
605610
target: 59..60,
606611
source_change: None,
607612
command: None,
@@ -734,7 +739,11 @@ pub fn test_some_range(a: int) -> bool {
734739
RefactorExtract,
735740
),
736741
label: "Extract into function",
737-
group: None,
742+
group: Some(
743+
GroupLabel(
744+
"Extract into...",
745+
),
746+
),
738747
target: 59..60,
739748
source_change: None,
740749
command: None,
@@ -953,7 +962,11 @@ pub fn test_some_range(a: int) -> bool {
953962
RefactorExtract,
954963
),
955964
label: "Extract into function",
956-
group: None,
965+
group: Some(
966+
GroupLabel(
967+
"Extract into...",
968+
),
969+
),
957970
target: 59..60,
958971
source_change: Some(
959972
SourceChange {

0 commit comments

Comments
 (0)