Skip to content

Commit a6c291e

Browse files
authored
Merge pull request #18652 from Giga-Bowser/extract-constant
feat: Add an assist to extract an expression into a constant
2 parents 3bd4597 + 21782b9 commit a6c291e

File tree

8 files changed

+1640
-312
lines changed

8 files changed

+1640
-312
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,

0 commit comments

Comments
 (0)