mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
add ssr doc
This commit is contained in:
parent
2cbe8a4c4b
commit
8ebd50fb99
1 changed files with 15 additions and 0 deletions
|
@ -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 `<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`.
|
||||
|
||||
```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.
|
||||
|
|
Loading…
Reference in a new issue