diff --git a/crates/libeditor/src/code_actions.rs b/crates/libeditor/src/code_actions.rs index ebe70681b9..4a07d1bc9a 100644 --- a/crates/libeditor/src/code_actions.rs +++ b/crates/libeditor/src/code_actions.rs @@ -109,17 +109,22 @@ pub fn introduce_variable<'a>(file: &'a File, range: TextRange) -> Optionvar_name = 1 + 1; foo(var_name); +}", + |file, range| introduce_variable(file, range).map(|f| f()), + ); + } + #[test] + fn test_intrdoduce_var_expr_stmt() { +check_action_range( + " +fn foo() { + <|>1 + 1<|>; +}", " +fn foo() { + let <|>var_name = 1 + 1; }", |file, range| introduce_variable(file, range).map(|f| f()), );