diff options
author | adamrk <[email protected]> | 2020-02-22 15:45:04 +0000 |
---|---|---|
committer | adamrk <[email protected]> | 2020-02-22 16:19:24 +0000 |
commit | 8ebd50fb9947f82b4af20ed97c7757b322d664e3 (patch) | |
tree | e2a6bed13c9defbdd1f9562c814101945c0d25af /docs | |
parent | 2cbe8a4c4be2a69b27c248ab96341c2336f983cd (diff) |
add ssr doc
Diffstat (limited to 'docs')
-rw-r--r-- | docs/user/features.md | 15 |
1 files changed, 15 insertions, 0 deletions
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 | |||
105 | 105 | ||
106 | Stop `cargo watch`. | 106 | Stop `cargo watch`. |
107 | 107 | ||
108 | #### Structural Seach and Replace | ||
109 | |||
110 | Search and replace with named wildcards that will match any expression. | ||
111 | The syntax for a structural search replace command is `<search_pattern> ==>> <replace_pattern>` where `$<name>:expr` in the search pattern will match any expression and `$<name>` will fill the matching expression in the replace pattern. Available via the command `rust-analyer.ssr`. | ||
112 | |||
113 | ```rust | ||
114 | // Using structural search replace command [foo($a:expr, $b:expr) ==>> ($a).foo($b)] | ||
115 | |||
116 | // BEFORE | ||
117 | String::from(foo(y + 5, z)) | ||
118 | |||
119 | // AFTER | ||
120 | String::from((y + 5).foo(z)) | ||
121 | ``` | ||
122 | |||
108 | ### Assists (Code Actions) | 123 | ### Assists (Code Actions) |
109 | 124 | ||
110 | Assists, or code actions, are small local refactorings, available in a particular context. | 125 | Assists, or code actions, are small local refactorings, available in a particular context. |