Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions crates/ide-assists/src/handlers/generate_delegate_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use syntax::{

use crate::{
AssistContext, AssistId, AssistKind, Assists, GroupLabel,
utils::{convert_param_list_to_arg_list, find_struct_impl},
utils::{convert_param_list_to_arg_list, find_struct_impl, pretty_node_inside_macro},
};

// Assist: generate_delegate_methods
Expand Down Expand Up @@ -121,6 +121,8 @@ pub(crate) fn generate_delegate_methods(
let source_scope = ctx.sema.scope(v.syntax());
let target_scope = ctx.sema.scope(strukt.syntax());
if let (Some(s), Some(t)) = (source_scope, target_scope) {
let v =
pretty_node_inside_macro(v, &ctx.sema, source.file_id, t.krate());
ast::Fn::cast(
PathTransform::generic_transformation(&t, &s).apply(v.syntax()),
)
Expand Down Expand Up @@ -669,7 +671,7 @@ impl<'a, T> Bar<'a, T> {
//- /bar.rs
macro_rules! test_method {
() => {
pub fn test(self, b: Bar) -> Self {
pub fn test(self, b: &mut Bar) -> Self {
self
}
};
Expand All @@ -696,7 +698,7 @@ struct Foo {
}

impl Foo {
$0pub fn test(self,b:bar::Bar) ->bar::Bar {
$0pub fn test(self,b: &mut bar::Bar) -> bar::Bar {
self.bar.test(b)
}
}
Expand Down
Loading
Loading