]> git.lizzy.rs Git - rust.git/commitdiff
Disable insert_import in extract_struct_from_enum_variant until its fixed
authorLukas Wirth <lukastw97@gmail.com>
Thu, 3 Sep 2020 16:32:29 +0000 (18:32 +0200)
committerLukas Wirth <lukastw97@gmail.com>
Thu, 3 Sep 2020 16:36:08 +0000 (18:36 +0200)
crates/assists/src/handlers/extract_struct_from_enum_variant.rs

index a50a57f1a90ed051c10a5953c6597ba0c2b5522d..eb812c1c9f13bf681211d09dbe2ea15733908497 100644 (file)
@@ -118,6 +118,7 @@ fn insert_import(
             make::path_from_text(&mod_path.to_string()),
             Some(MergeBehaviour::Full),
         );
+        // FIXME: this will currently panic as multiple imports will have overlapping text ranges
         builder.replace(syntax.text_range(), new_syntax.to_string())
     }
     Some(())
@@ -191,6 +192,7 @@ fn update_reference(
         list_range.end().checked_sub(TextSize::from(1))?,
     );
     builder.edit_file(reference.file_range.file_id);
+    /* FIXME: this most likely requires AST-based editing, see `insert_import`
     if !visited_modules_set.contains(&module) {
         if insert_import(ctx, builder, &path_expr, &module, enum_module_def, variant_hir_name)
             .is_some()
@@ -198,6 +200,7 @@ fn update_reference(
             visited_modules_set.insert(module);
         }
     }
+    */
     builder.replace(inside_list_range, format!("{}{}", segment, list));
     Some(())
 }
@@ -256,6 +259,7 @@ pub enum A { One(One) }"#,
     }
 
     #[test]
+    #[ignore] // FIXME: this currently panics if `insert_import` is used
     fn test_extract_struct_with_complex_imports() {
         check_assist(
             extract_struct_from_enum_variant,