From d29b69cbe61d20556c55e4f6a53da0784df8b6d0 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 3 Sep 2020 18:32:29 +0200 Subject: Disable insert_import in extract_struct_from_enum_variant until its fixed --- crates/assists/src/handlers/extract_struct_from_enum_variant.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates/assists') diff --git a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs index a50a57f1a..eb812c1c9 100644 --- a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs @@ -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, -- cgit v1.2.3