feat: add multiple getters mode in generate_getter

This commit adds two modes to generate_getter action.
First, the plain old working on single fields.
Second, working on a selected range of fields.
This commit is contained in:
feniljain 2022-10-08 00:54:57 +05:30
parent 97b357e41b
commit 5bff6c55de
8 changed files with 290 additions and 67 deletions

View file

@ -198,7 +198,7 @@ fn get_adt_source(
let file = ctx.sema.parse(range.file_id);
let adt_source =
ctx.sema.find_node_at_offset_with_macros(file.syntax(), range.range.start())?;
find_struct_impl(ctx, &adt_source, fn_name).map(|impl_| (impl_, range.file_id))
find_struct_impl(ctx, &adt_source, &[fn_name.to_string()]).map(|impl_| (impl_, range.file_id))
}
struct FunctionTemplate {