File tree Expand file tree Collapse file tree
crates/ide-assists/src/handlers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2830,6 +2830,7 @@ fn main() {
28302830
28312831 #[ test]
28322832 fn extract_variable_in_token_tree ( ) {
2833+ // FIXME: Keep the original trivia instead of extracting macro expanded?
28332834 check_assist_by_label (
28342835 extract_variable,
28352836 r#"
@@ -2910,6 +2911,39 @@ fn main() {
29102911 let $0var_name = 2+3+4;
29112912 let x = foo!(= var_name);
29122913}
2914+ "# ,
2915+ "Extract into variable" ,
2916+ ) ;
2917+
2918+ // FIXME: Extract to inside the macro instead of outside the macro
2919+ check_assist_by_label (
2920+ extract_variable,
2921+ r#"
2922+ macro_rules! foo {
2923+ (= $($t:tt)*) => {
2924+ $($t)*
2925+ };
2926+ }
2927+
2928+ fn main() {
2929+ let x = foo!(= {
2930+ $02 + 3 + 4$0
2931+ });
2932+ }
2933+ "# ,
2934+ r#"
2935+ macro_rules! foo {
2936+ (= $($t:tt)*) => {
2937+ $($t)*
2938+ };
2939+ }
2940+
2941+ fn main() {
2942+ let $0var_name = 2+3+4;
2943+ let x = foo!(= {
2944+ var_name
2945+ });
2946+ }
29132947"# ,
29142948 "Extract into variable" ,
29152949 ) ;
You can’t perform that action at this time.
0 commit comments