Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/handlers/generate_new.rs')
| -rw-r--r-- | crates/ide-assists/src/handlers/generate_new.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/ide-assists/src/handlers/generate_new.rs b/crates/ide-assists/src/handlers/generate_new.rs index 520709adc5..40adfceaae 100644 --- a/crates/ide-assists/src/handlers/generate_new.rs +++ b/crates/ide-assists/src/handlers/generate_new.rs @@ -1,6 +1,6 @@ use ide_db::{ imports::import_assets::item_for_path_search, syntax_helpers::suggest_name::NameGenerator, - use_trivial_constructor::use_trivial_constructor, + use_trivial_constructor::use_trivial_constructor_with_factory, }; use syntax::{ ast::{self, AstNode, HasName, HasVisibility, StructKind, edit::AstNodeEdit}, @@ -33,7 +33,7 @@ use crate::{ // } // } // ``` -pub(crate) fn generate_new(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<()> { +pub(crate) fn generate_new(acc: &mut Assists, ctx: &AssistContext<'_, '_>) -> Option<()> { let strukt = ctx.find_node_at_offset::<ast::Struct>()?; let field_list: Vec<(String, ast::Type)> = match strukt.kind() { StructKind::Record(named) => { @@ -90,9 +90,10 @@ pub(crate) fn generate_new(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option let edition = current_module.krate(ctx.db()).edition(ctx.db()); - let expr = use_trivial_constructor( + let expr = use_trivial_constructor_with_factory( + make, ctx.sema.db, - ide_db::helpers::mod_path_to_ast(&type_path, edition), + ide_db::helpers::mod_path_to_ast_with_factory(make, &type_path, edition), &ty, edition, )?; |