diff options
Diffstat (limited to 'docs/user/generated_features.adoc')
-rw-r--r-- | docs/user/generated_features.adoc | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/docs/user/generated_features.adoc b/docs/user/generated_features.adoc new file mode 100644 index 000000000..e1eb5d88a --- /dev/null +++ b/docs/user/generated_features.adoc | |||
@@ -0,0 +1,98 @@ | |||
1 | === Extend Selection | ||
2 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/extend_selection.rs[extend_selection.rs] | ||
3 | |||
4 | |||
5 | Extends the current selection to the encompassing syntactic construct | ||
6 | (expression, statement, item, module, etc). It works with multiple cursors. | ||
7 | |||
8 | |=== | ||
9 | | Editor | Shortcut | ||
10 | |||
11 | | VS Code | kbd:[Ctrl+Shift+→] | ||
12 | |=== | ||
13 | |||
14 | |||
15 | === File Structure | ||
16 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/display/structure.rs[structure.rs] | ||
17 | |||
18 | |||
19 | Provides a tree of the symbols defined in the file. Can be used to | ||
20 | |||
21 | * fuzzy search symbol in a file (super useful) | ||
22 | * draw breadcrumbs to describe the context around the cursor | ||
23 | * draw outline of the file | ||
24 | |||
25 | |=== | ||
26 | | Editor | Shortcut | ||
27 | |||
28 | | VS Code | kbd:[Ctrl+Shift+O] | ||
29 | |=== | ||
30 | |||
31 | |||
32 | === Go To Definition | ||
33 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/goto_definition.rs[goto_definition.rs] | ||
34 | |||
35 | |||
36 | Navigates to the definition of an identifier. | ||
37 | |||
38 | |=== | ||
39 | | Editor | Shortcut | ||
40 | |||
41 | | VS Code | kbd:[F12] | ||
42 | |=== | ||
43 | |||
44 | |||
45 | === Go To Implementation | ||
46 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/goto_implementation.rs[goto_implementation.rs] | ||
47 | |||
48 | |||
49 | Navigates to the impl block of structs, enums or traits. Also implemented as a code lens. | ||
50 | |||
51 | |=== | ||
52 | | Editor | Shortcut | ||
53 | |||
54 | | VS Code | kbd:[Ctrl+F12] | ||
55 | |=== | ||
56 | |||
57 | |||
58 | === Go To Type Definition | ||
59 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/goto_type_definition.rs[goto_type_definition.rs] | ||
60 | |||
61 | |||
62 | Navigates to the type of an identifier. | ||
63 | |||
64 | |||
65 | === On Typing Assists | ||
66 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/typing.rs[typing.rs] | ||
67 | |||
68 | |||
69 | Some features trigger on typing certain characters: | ||
70 | |||
71 | - typing `let =` tries to smartly add `;` if `=` is followed by an existing expression | ||
72 | - Enter inside comments automatically inserts `///` | ||
73 | - typing `.` in a chain method call auto-indents | ||
74 | |||
75 | |||
76 | === Workspace Symbol | ||
77 | **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide_db/src/symbol_index.rs[symbol_index.rs] | ||
78 | |||
79 | |||
80 | Uses fuzzy-search to find types, modules and functions by name across your | ||
81 | project and dependencies. This is **the** most useful feature, which improves code | ||
82 | navigation tremendously. It mostly works on top of the built-in LSP | ||
83 | functionality, however `#` and `*` symbols can be used to narrow down the | ||
84 | search. Specifically, | ||
85 | |||
86 | - `Foo` searches for `Foo` type in the current workspace | ||
87 | - `foo#` searches for `foo` function in the current workspace | ||
88 | - `Foo*` searches for `Foo` type among dependencies, including `stdlib` | ||
89 | - `foo#*` searches for `foo` function among dependencies | ||
90 | |||
91 | That is, `#` switches from "types" to all symbols, `*` switches from the current | ||
92 | workspace to dependencies. | ||
93 | |||
94 | |=== | ||
95 | | Editor | Shortcut | ||
96 | |||
97 | | VS Code | kbd:[Ctrl+T] | ||
98 | |=== | ||