diff options
Diffstat (limited to 'docs/user')
-rw-r--r-- | docs/user/assists.md | 18 | ||||
-rw-r--r-- | docs/user/features.md | 16 | ||||
-rw-r--r-- | docs/user/generated_features.adoc | 55 |
3 files changed, 73 insertions, 16 deletions
diff --git a/docs/user/assists.md b/docs/user/assists.md index 4ad7ea59d..b5d813b54 100644 --- a/docs/user/assists.md +++ b/docs/user/assists.md | |||
@@ -56,6 +56,24 @@ fn main() { | |||
56 | } | 56 | } |
57 | ``` | 57 | ``` |
58 | 58 | ||
59 | ## `add_from_impl_for_enum` | ||
60 | |||
61 | Adds a From impl for an enum variant with one tuple field. | ||
62 | |||
63 | ```rust | ||
64 | // BEFORE | ||
65 | enum A { ┃One(u32) } | ||
66 | |||
67 | // AFTER | ||
68 | enum A { One(u32) } | ||
69 | |||
70 | impl From<u32> for A { | ||
71 | fn from(v: u32) -> Self { | ||
72 | A::One(v) | ||
73 | } | ||
74 | } | ||
75 | ``` | ||
76 | |||
59 | ## `add_function` | 77 | ## `add_function` |
60 | 78 | ||
61 | Adds a stub function with a signature matching the function under the cursor. | 79 | Adds a stub function with a signature matching the function under the cursor. |
diff --git a/docs/user/features.md b/docs/user/features.md index df8e73a20..ba7ca15a6 100644 --- a/docs/user/features.md +++ b/docs/user/features.md | |||
@@ -4,24 +4,8 @@ you can use <kbd>Ctrl+Shift+P</kbd> to search for the corresponding action. | |||
4 | 4 | ||
5 | ### Commands <kbd>ctrl+shift+p</kbd> | 5 | ### Commands <kbd>ctrl+shift+p</kbd> |
6 | 6 | ||
7 | #### Parent Module | ||
8 | 7 | ||
9 | Navigates to the parent module of the current module. | ||
10 | 8 | ||
11 | #### Matching Brace | ||
12 | |||
13 | If the cursor is on any brace (`<>(){}[]`) which is a part of a brace-pair, | ||
14 | moves cursor to the matching brace. It uses the actual parser to determine | ||
15 | braces, so it won't confuse generics with comparisons. | ||
16 | |||
17 | #### Join Lines | ||
18 | |||
19 | Join selected lines into one, smartly fixing up whitespace and trailing commas. | ||
20 | |||
21 | #### Show Syntax Tree | ||
22 | |||
23 | Shows the parse tree of the current file. It exists mostly for debugging | ||
24 | rust-analyzer itself. | ||
25 | 9 | ||
26 | #### Expand Macro Recursively | 10 | #### Expand Macro Recursively |
27 | 11 | ||
diff --git a/docs/user/generated_features.adoc b/docs/user/generated_features.adoc index 1f6fcc974..bf0a36d01 100644 --- a/docs/user/generated_features.adoc +++ b/docs/user/generated_features.adoc | |||
@@ -68,6 +68,34 @@ Navigates to the type of an identifier. | |||
68 | |=== | 68 | |=== |
69 | 69 | ||
70 | 70 | ||
71 | === Join Lines | ||
72 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/join_lines.rs[join_lines.rs] | ||
73 | |||
74 | |||
75 | Join selected lines into one, smartly fixing up whitespace, trailing commas, and braces. | ||
76 | |||
77 | |=== | ||
78 | | Editor | Action Name | ||
79 | |||
80 | | VS Code | **Rust Analyzer: Join lines** | ||
81 | |=== | ||
82 | |||
83 | |||
84 | === Matching Brace | ||
85 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/matching_brace.rs[matching_brace.rs] | ||
86 | |||
87 | |||
88 | If the cursor is on any brace (`<>(){}[]`) which is a part of a brace-pair, | ||
89 | moves cursor to the matching brace. It uses the actual parser to determine | ||
90 | braces, so it won't confuse generics with comparisons. | ||
91 | |||
92 | |=== | ||
93 | | Editor | Action Name | ||
94 | |||
95 | | VS Code | **Rust Analyzer: Find matching brace** | ||
96 | |=== | ||
97 | |||
98 | |||
71 | === On Typing Assists | 99 | === On Typing Assists |
72 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/typing.rs[typing.rs] | 100 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/typing.rs[typing.rs] |
73 | 101 | ||
@@ -79,6 +107,19 @@ Some features trigger on typing certain characters: | |||
79 | - typing `.` in a chain method call auto-indents | 107 | - typing `.` in a chain method call auto-indents |
80 | 108 | ||
81 | 109 | ||
110 | === Parent Module | ||
111 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/parent_module.rs[parent_module.rs] | ||
112 | |||
113 | |||
114 | Navigates to the parent module of the current module. | ||
115 | |||
116 | |=== | ||
117 | | Editor | Action Name | ||
118 | |||
119 | | VS Code | **Rust Analyzer: Locate parent module** | ||
120 | |=== | ||
121 | |||
122 | |||
82 | === Run | 123 | === Run |
83 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/runnables.rs[runnables.rs] | 124 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/runnables.rs[runnables.rs] |
84 | 125 | ||
@@ -94,6 +135,20 @@ to a shortcut! | |||
94 | |=== | 135 | |=== |
95 | 136 | ||
96 | 137 | ||
138 | === Show Syntax Tree | ||
139 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/syntax_tree.rs[syntax_tree.rs] | ||
140 | |||
141 | |||
142 | Shows the parse tree of the current file. It exists mostly for debugging | ||
143 | rust-analyzer itself. | ||
144 | |||
145 | |=== | ||
146 | | Editor | Action Name | ||
147 | |||
148 | | VS Code | **Rust Analyzer: Show Syntax Tree** | ||
149 | |=== | ||
150 | |||
151 | |||
97 | === Workspace Symbol | 152 | === Workspace Symbol |
98 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide_db/src/symbol_index.rs[symbol_index.rs] | 153 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide_db/src/symbol_index.rs[symbol_index.rs] |
99 | 154 | ||