From 3dac31fe80b9d7279e87b94615b0d55805e83412 Mon Sep 17 00:00:00 2001 From: David Lattimore Date: Fri, 24 Jul 2020 20:53:48 +1000 Subject: SSR: Allow function calls to match method calls This differs from how this used to work before I removed it in that: a) It's only one direction. Function calls in the pattern can match method calls in the code, but not the other way around. b) We now check that the function call in the pattern resolves to the same function as the method call in the code. The lack of (b) was the reason I felt the need to remove the feature before. --- crates/ra_ide/src/ssr.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/ssr.rs b/crates/ra_ide/src/ssr.rs index 2f40bac08..95d8f79b8 100644 --- a/crates/ra_ide/src/ssr.rs +++ b/crates/ra_ide/src/ssr.rs @@ -21,6 +21,9 @@ use ra_ssr::{MatchFinder, SsrError, SsrRule}; // replacement occurs. For example if our replacement template is `foo::Bar` and we match some // code in the `foo` module, we'll insert just `Bar`. // +// Method calls should generally be written in UFCS form. e.g. `foo::Bar::baz($s, $a)` will match +// `$s.baz($a)`, provided the method call `baz` resolves to the method `foo::Bar::baz`. +// // Placeholders may be given constraints by writing them as `${::...}`. // // Supported constraints: -- cgit v1.2.3