From 8ebd50fb9947f82b4af20ed97c7757b322d664e3 Mon Sep 17 00:00:00 2001 From: adamrk Date: Sat, 22 Feb 2020 16:45:04 +0100 Subject: add ssr doc --- docs/user/features.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'docs') diff --git a/docs/user/features.md b/docs/user/features.md index a9cff34d2..56a2f025c 100644 --- a/docs/user/features.md +++ b/docs/user/features.md @@ -105,6 +105,21 @@ Start `cargo watch` for live error highlighting. Will prompt to install if it's Stop `cargo watch`. +#### Structural Seach and Replace + +Search and replace with named wildcards that will match any expression. +The syntax for a structural search replace command is ` ==>> ` where `$:expr` in the search pattern will match any expression and `$` will fill the matching expression in the replace pattern. Available via the command `rust-analyer.ssr`. + +```rust +// Using structural search replace command [foo($a:expr, $b:expr) ==>> ($a).foo($b)] + +// BEFORE +String::from(foo(y + 5, z)) + +// AFTER +String::from((y + 5).foo(z)) +``` + ### Assists (Code Actions) Assists, or code actions, are small local refactorings, available in a particular context. -- cgit v1.2.3 From 28367f7e4fc0771c9ee2a01163db0f632ea6600b Mon Sep 17 00:00:00 2001 From: Adam Bratschi-Kaye Date: Sat, 22 Feb 2020 18:07:43 +0100 Subject: rewording and typo fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Laurențiu Nicola --- docs/user/features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/user/features.md b/docs/user/features.md index 56a2f025c..48c63ba7b 100644 --- a/docs/user/features.md +++ b/docs/user/features.md @@ -108,7 +108,7 @@ Stop `cargo watch`. #### Structural Seach and Replace Search and replace with named wildcards that will match any expression. -The syntax for a structural search replace command is ` ==>> ` where `$:expr` in the search pattern will match any expression and `$` will fill the matching expression in the replace pattern. Available via the command `rust-analyer.ssr`. +The syntax for a structural search replace command is ` ==>> `. A `$:expr` placeholder in the search pattern will match any expression and `$` will reference it in the replacement. Available via the command `rust-analyzer.ssr`. ```rust // Using structural search replace command [foo($a:expr, $b:expr) ==>> ($a).foo($b)] -- cgit v1.2.3