diff options
author | Aleksey Kladov <[email protected]> | 2020-05-31 00:54:54 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-31 00:54:54 +0100 |
commit | c8f27a4a886413a15a2a6af4a87b39b901c873a8 (patch) | |
tree | ae4f7c31fa30581ef09b3c29d2673dee922e5845 /docs/user | |
parent | 383247a9ae8202f20ce6f01d1429c1cd2a11d516 (diff) |
Generate features docs from source
Diffstat (limited to 'docs/user')
-rw-r--r-- | docs/user/features.md | 52 | ||||
-rw-r--r-- | docs/user/generated_features.adoc | 98 | ||||
-rw-r--r-- | docs/user/readme.adoc | 5 |
3 files changed, 101 insertions, 54 deletions
diff --git a/docs/user/features.md b/docs/user/features.md index 12ecdec13..4d9402252 100644 --- a/docs/user/features.md +++ b/docs/user/features.md | |||
@@ -2,58 +2,6 @@ This document is an index of features that the rust-analyzer language server | |||
2 | provides. Shortcuts are for the default VS Code layout. If there's no shortcut, | 2 | provides. Shortcuts are for the default VS Code layout. If there's no shortcut, |
3 | you can use <kbd>Ctrl+Shift+P</kbd> to search for the corresponding action. | 3 | you can use <kbd>Ctrl+Shift+P</kbd> to search for the corresponding action. |
4 | 4 | ||
5 | ### Workspace Symbol <kbd>ctrl+t</kbd> | ||
6 | |||
7 | Uses fuzzy-search to find types, modules and functions by name across your | ||
8 | project and dependencies. This is **the** most useful feature, which improves code | ||
9 | navigation tremendously. It mostly works on top of the built-in LSP | ||
10 | functionality, however `#` and `*` symbols can be used to narrow down the | ||
11 | search. Specifically, | ||
12 | |||
13 | - `Foo` searches for `Foo` type in the current workspace | ||
14 | - `foo#` searches for `foo` function in the current workspace | ||
15 | - `Foo*` searches for `Foo` type among dependencies, including `stdlib` | ||
16 | - `foo#*` searches for `foo` function among dependencies | ||
17 | |||
18 | That is, `#` switches from "types" to all symbols, `*` switches from the current | ||
19 | workspace to dependencies. | ||
20 | |||
21 | ### Document Symbol <kbd>ctrl+shift+o</kbd> | ||
22 | |||
23 | Provides a tree of the symbols defined in the file. Can be used to | ||
24 | |||
25 | * fuzzy search symbol in a file (super useful) | ||
26 | * draw breadcrumbs to describe the context around the cursor | ||
27 | * draw outline of the file | ||
28 | |||
29 | ### On Typing Assists | ||
30 | |||
31 | Some features trigger on typing certain characters: | ||
32 | |||
33 | - typing `let =` tries to smartly add `;` if `=` is followed by an existing expression | ||
34 | - Enter inside comments automatically inserts `///` | ||
35 | - typing `.` in a chain method call auto-indents | ||
36 | |||
37 | ### Extend Selection | ||
38 | |||
39 | Extends the current selection to the encompassing syntactic construct | ||
40 | (expression, statement, item, module, etc). It works with multiple cursors. This | ||
41 | is a relatively new feature of LSP: | ||
42 | https://github.com/Microsoft/language-server-protocol/issues/613, check your | ||
43 | editor's LSP library to see if this feature is supported. | ||
44 | |||
45 | ### Go to Definition | ||
46 | |||
47 | Navigates to the definition of an identifier. | ||
48 | |||
49 | ### Go to Implementation | ||
50 | |||
51 | Navigates to the impl block of structs, enums or traits. Also implemented as a code lens. | ||
52 | |||
53 | ### Go to Type Defintion | ||
54 | |||
55 | Navigates to the type of an identifier. | ||
56 | |||
57 | ### Commands <kbd>ctrl+shift+p</kbd> | 5 | ### Commands <kbd>ctrl+shift+p</kbd> |
58 | 6 | ||
59 | #### Run | 7 | #### Run |
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 | |=== | ||
diff --git a/docs/user/readme.adoc b/docs/user/readme.adoc index 64bd0feb1..7b159bfc6 100644 --- a/docs/user/readme.adoc +++ b/docs/user/readme.adoc | |||
@@ -8,6 +8,7 @@ | |||
8 | :important-caption: :heavy_exclamation_mark: | 8 | :important-caption: :heavy_exclamation_mark: |
9 | :caution-caption: :fire: | 9 | :caution-caption: :fire: |
10 | :warning-caption: :warning: | 10 | :warning-caption: :warning: |
11 | :experimental: | ||
11 | 12 | ||
12 | // Master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository | 13 | // Master copy of this document lives in the https://github.com/rust-analyzer/rust-analyzer repository |
13 | 14 | ||
@@ -268,6 +269,6 @@ Gnome Builder currently has support for RLS, and there's no way to configure the | |||
268 | 1. Rename, symlink or copy the `rust-analyzer` binary to `rls` and place it somewhere Builder can find (in `PATH`, or under `~/.cargo/bin`). | 269 | 1. Rename, symlink or copy the `rust-analyzer` binary to `rls` and place it somewhere Builder can find (in `PATH`, or under `~/.cargo/bin`). |
269 | 2. Enable the Rust Builder plugin. | 270 | 2. Enable the Rust Builder plugin. |
270 | 271 | ||
271 | == Usage | 272 | == Features |
272 | 273 | ||
273 | See https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/features.md[features.md]. | 274 | include::./generated_features.adoc[] |