mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
minor: Group extract_function
with other extraction assists
This commit is contained in:
parent
0cad614b3b
commit
21782b9a8d
2 changed files with 23 additions and 8 deletions
|
@ -7,6 +7,7 @@ use hir::{
|
||||||
TypeInfo, TypeParam,
|
TypeInfo, TypeParam,
|
||||||
};
|
};
|
||||||
use ide_db::{
|
use ide_db::{
|
||||||
|
assists::GroupLabel,
|
||||||
defs::{Definition, NameRefClass},
|
defs::{Definition, NameRefClass},
|
||||||
famous_defs::FamousDefs,
|
famous_defs::FamousDefs,
|
||||||
helpers::mod_path_to_ast,
|
helpers::mod_path_to_ast,
|
||||||
|
@ -104,7 +105,8 @@ pub(crate) fn extract_function(acc: &mut Assists, ctx: &AssistContext<'_>) -> Op
|
||||||
|
|
||||||
let scope = ImportScope::find_insert_use_container(&node, &ctx.sema)?;
|
let scope = ImportScope::find_insert_use_container(&node, &ctx.sema)?;
|
||||||
|
|
||||||
acc.add(
|
acc.add_group(
|
||||||
|
&GroupLabel("Extract into...".to_owned()),
|
||||||
AssistId("extract_function", crate::AssistKind::RefactorExtract),
|
AssistId("extract_function", crate::AssistKind::RefactorExtract),
|
||||||
"Extract into function",
|
"Extract into function",
|
||||||
target_range,
|
target_range,
|
||||||
|
|
|
@ -363,7 +363,6 @@ pub fn test_some_range(a: int) -> bool {
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
Convert integer base
|
Convert integer base
|
||||||
Extract into...
|
Extract into...
|
||||||
Extract into function
|
|
||||||
Replace if let with match
|
Replace if let with match
|
||||||
"#]]
|
"#]]
|
||||||
.assert_eq(&expected);
|
.assert_eq(&expected);
|
||||||
|
@ -392,7 +391,6 @@ pub fn test_some_range(a: int) -> bool {
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
Convert integer base
|
Convert integer base
|
||||||
Extract into...
|
Extract into...
|
||||||
Extract into function
|
|
||||||
Replace if let with match
|
Replace if let with match
|
||||||
"#]]
|
"#]]
|
||||||
.assert_eq(&expected);
|
.assert_eq(&expected);
|
||||||
|
@ -406,7 +404,6 @@ pub fn test_some_range(a: int) -> bool {
|
||||||
|
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
Extract into...
|
Extract into...
|
||||||
Extract into function
|
|
||||||
"#]]
|
"#]]
|
||||||
.assert_eq(&expected);
|
.assert_eq(&expected);
|
||||||
}
|
}
|
||||||
|
@ -511,7 +508,11 @@ pub fn test_some_range(a: int) -> bool {
|
||||||
RefactorExtract,
|
RefactorExtract,
|
||||||
),
|
),
|
||||||
label: "Extract into function",
|
label: "Extract into function",
|
||||||
group: None,
|
group: Some(
|
||||||
|
GroupLabel(
|
||||||
|
"Extract into...",
|
||||||
|
),
|
||||||
|
),
|
||||||
target: 59..60,
|
target: 59..60,
|
||||||
source_change: None,
|
source_change: None,
|
||||||
command: None,
|
command: None,
|
||||||
|
@ -601,7 +602,11 @@ pub fn test_some_range(a: int) -> bool {
|
||||||
RefactorExtract,
|
RefactorExtract,
|
||||||
),
|
),
|
||||||
label: "Extract into function",
|
label: "Extract into function",
|
||||||
group: None,
|
group: Some(
|
||||||
|
GroupLabel(
|
||||||
|
"Extract into...",
|
||||||
|
),
|
||||||
|
),
|
||||||
target: 59..60,
|
target: 59..60,
|
||||||
source_change: None,
|
source_change: None,
|
||||||
command: None,
|
command: None,
|
||||||
|
@ -734,7 +739,11 @@ pub fn test_some_range(a: int) -> bool {
|
||||||
RefactorExtract,
|
RefactorExtract,
|
||||||
),
|
),
|
||||||
label: "Extract into function",
|
label: "Extract into function",
|
||||||
group: None,
|
group: Some(
|
||||||
|
GroupLabel(
|
||||||
|
"Extract into...",
|
||||||
|
),
|
||||||
|
),
|
||||||
target: 59..60,
|
target: 59..60,
|
||||||
source_change: None,
|
source_change: None,
|
||||||
command: None,
|
command: None,
|
||||||
|
@ -953,7 +962,11 @@ pub fn test_some_range(a: int) -> bool {
|
||||||
RefactorExtract,
|
RefactorExtract,
|
||||||
),
|
),
|
||||||
label: "Extract into function",
|
label: "Extract into function",
|
||||||
group: None,
|
group: Some(
|
||||||
|
GroupLabel(
|
||||||
|
"Extract into...",
|
||||||
|
),
|
||||||
|
),
|
||||||
target: 59..60,
|
target: 59..60,
|
||||||
source_change: Some(
|
source_change: Some(
|
||||||
SourceChange {
|
SourceChange {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue