···1024810248 .select_until(find_position_of("}\n").under_char('\n'))
1024910249 );
1025010250}
1025110251+1025210252+#[test]
1025310253+fn extract_function_from_statements() {
1025410254+ assert_code_action!(
1025510255+ EXTRACT_FUNCTION,
1025610256+ "
1025710257+pub fn do_things(a, b) {
1025810258+ let a = 10 + a
1025910259+ let b = 10 + b
1026010260+ let result = a * b
1026110261+ result + 3
1026210262+}
1026310263+",
1026410264+ find_position_of("let").select_until(find_position_of("* b\n").under_char('\n'))
1026510265+ );
1026610266+}
···11+---
22+source: compiler-core/src/language_server/tests/action.rs
33+expression: "\npub fn do_things(a, b) {\n let a = 10 + a\n let b = 10 + b\n let result = a * b\n result + 3\n}\n"
44+---
55+----- BEFORE ACTION
66+77+pub fn do_things(a, b) {
88+ let a = 10 + a
99+ ▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1010+ let b = 10 + b
1111+▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1212+ let result = a * b
1313+▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1414+ result + 3
1515+}
1616+1717+1818+----- AFTER ACTION
1919+2020+pub fn do_things(a, b) {
2121+ function(a, b)
2222+ result + 3
2323+}
2424+2525+fn function(a: Int, b: Int) -> Int {
2626+ let a = 10 + a
2727+ let b = 10 + b
2828+ let result = a * b
2929+}