diff options
Diffstat (limited to 'docs/user')
-rw-r--r-- | docs/user/assists.md | 24 | ||||
-rw-r--r-- | docs/user/features.md | 4 |
2 files changed, 27 insertions, 1 deletions
diff --git a/docs/user/assists.md b/docs/user/assists.md new file mode 100644 index 000000000..cb4b0b9fb --- /dev/null +++ b/docs/user/assists.md | |||
@@ -0,0 +1,24 @@ | |||
1 | # Assists | ||
2 | |||
3 | ## `convert_to_guarded_return` | ||
4 | |||
5 | Replace a large conditional with a guarded return. | ||
6 | |||
7 | ```rust | ||
8 | // BEFORE | ||
9 | fn main() { | ||
10 | <|>if cond { | ||
11 | foo(); | ||
12 | bar(); | ||
13 | } | ||
14 | } | ||
15 | |||
16 | // AFTER | ||
17 | fn main() { | ||
18 | if !cond { | ||
19 | return; | ||
20 | } | ||
21 | foo(); | ||
22 | bar(); | ||
23 | } | ||
24 | ``` | ||
diff --git a/docs/user/features.md b/docs/user/features.md index 8b7a8d7fc..a94b65ad4 100644 --- a/docs/user/features.md +++ b/docs/user/features.md | |||
@@ -97,11 +97,13 @@ Start `cargo watch` for live error highlighting. Will prompt to install if it's | |||
97 | 97 | ||
98 | Stop `cargo watch` | 98 | Stop `cargo watch` |
99 | 99 | ||
100 | ### Code Actions (Assists) | 100 | ### Assists (Code Actions) |
101 | 101 | ||
102 | These are triggered in a particular context via light bulb. We use custom code on | 102 | These are triggered in a particular context via light bulb. We use custom code on |
103 | the VS Code side to be able to position cursor. `<|>` signifies cursor | 103 | the VS Code side to be able to position cursor. `<|>` signifies cursor |
104 | 104 | ||
105 | See [assists.md](./assists.md) | ||
106 | |||
105 | - Add `#[derive]` | 107 | - Add `#[derive]` |
106 | 108 | ||
107 | ```rust | 109 | ```rust |