aboutsummaryrefslogtreecommitdiff
path: root/crates/assists
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2020-09-03 17:32:29 +0100
committerLukas Wirth <[email protected]>2020-09-03 17:36:08 +0100
commitd29b69cbe61d20556c55e4f6a53da0784df8b6d0 (patch)
treede5ad0eb0ac5b3ab899cee4c14893b7f4abdefc1 /crates/assists
parent7de2a30f4080d0e6d8790882238bed1cb6ccbc21 (diff)
Disable insert_import in extract_struct_from_enum_variant until its fixed
Diffstat (limited to 'crates/assists')
-rw-r--r--crates/assists/src/handlers/extract_struct_from_enum_variant.rs4
1 files changed, 4 insertions, 0 deletions
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(
118 make::path_from_text(&mod_path.to_string()), 118 make::path_from_text(&mod_path.to_string()),
119 Some(MergeBehaviour::Full), 119 Some(MergeBehaviour::Full),
120 ); 120 );
121 // FIXME: this will currently panic as multiple imports will have overlapping text ranges
121 builder.replace(syntax.text_range(), new_syntax.to_string()) 122 builder.replace(syntax.text_range(), new_syntax.to_string())
122 } 123 }
123 Some(()) 124 Some(())
@@ -191,6 +192,7 @@ fn update_reference(
191 list_range.end().checked_sub(TextSize::from(1))?, 192 list_range.end().checked_sub(TextSize::from(1))?,
192 ); 193 );
193 builder.edit_file(reference.file_range.file_id); 194 builder.edit_file(reference.file_range.file_id);
195 /* FIXME: this most likely requires AST-based editing, see `insert_import`
194 if !visited_modules_set.contains(&module) { 196 if !visited_modules_set.contains(&module) {
195 if insert_import(ctx, builder, &path_expr, &module, enum_module_def, variant_hir_name) 197 if insert_import(ctx, builder, &path_expr, &module, enum_module_def, variant_hir_name)
196 .is_some() 198 .is_some()
@@ -198,6 +200,7 @@ fn update_reference(
198 visited_modules_set.insert(module); 200 visited_modules_set.insert(module);
199 } 201 }
200 } 202 }
203 */
201 builder.replace(inside_list_range, format!("{}{}", segment, list)); 204 builder.replace(inside_list_range, format!("{}{}", segment, list));
202 Some(()) 205 Some(())
203} 206}
@@ -256,6 +259,7 @@ pub enum A { One(One) }"#,
256 } 259 }
257 260
258 #[test] 261 #[test]
262 #[ignore] // FIXME: this currently panics if `insert_import` is used
259 fn test_extract_struct_with_complex_imports() { 263 fn test_extract_struct_with_complex_imports() {
260 check_assist( 264 check_assist(
261 extract_struct_from_enum_variant, 265 extract_struct_from_enum_variant,