aboutsummaryrefslogtreecommitdiff
path: root/docs/user
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-05-31 00:54:54 +0100
committerAleksey Kladov <[email protected]>2020-05-31 00:54:54 +0100
commitc8f27a4a886413a15a2a6af4a87b39b901c873a8 (patch)
treeae4f7c31fa30581ef09b3c29d2673dee922e5845 /docs/user
parent383247a9ae8202f20ce6f01d1429c1cd2a11d516 (diff)
Generate features docs from source
Diffstat (limited to 'docs/user')
-rw-r--r--docs/user/features.md52
-rw-r--r--docs/user/generated_features.adoc98
-rw-r--r--docs/user/readme.adoc5
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
2provides. Shortcuts are for the default VS Code layout. If there's no shortcut, 2provides. Shortcuts are for the default VS Code layout. If there's no shortcut,
3you can use <kbd>Ctrl+Shift+P</kbd> to search for the corresponding action. 3you can use <kbd>Ctrl+Shift+P</kbd> to search for the corresponding action.
4 4
5### Workspace Symbol <kbd>ctrl+t</kbd>
6
7Uses fuzzy-search to find types, modules and functions by name across your
8project and dependencies. This is **the** most useful feature, which improves code
9navigation tremendously. It mostly works on top of the built-in LSP
10functionality, however `#` and `*` symbols can be used to narrow down the
11search. 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
18That is, `#` switches from "types" to all symbols, `*` switches from the current
19workspace to dependencies.
20
21### Document Symbol <kbd>ctrl+shift+o</kbd>
22
23Provides 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
31Some 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
39Extends the current selection to the encompassing syntactic construct
40(expression, statement, item, module, etc). It works with multiple cursors. This
41is a relatively new feature of LSP:
42https://github.com/Microsoft/language-server-protocol/issues/613, check your
43editor's LSP library to see if this feature is supported.
44
45### Go to Definition
46
47Navigates to the definition of an identifier.
48
49### Go to Implementation
50
51Navigates to the impl block of structs, enums or traits. Also implemented as a code lens.
52
53### Go to Type Defintion
54
55Navigates 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
5Extends 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
19Provides 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
36Navigates 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
49Navigates 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
62Navigates 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
69Some 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
80Uses fuzzy-search to find types, modules and functions by name across your
81project and dependencies. This is **the** most useful feature, which improves code
82navigation tremendously. It mostly works on top of the built-in LSP
83functionality, however `#` and `*` symbols can be used to narrow down the
84search. 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
91That is, `#` switches from "types" to all symbols, `*` switches from the current
92workspace 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
2681. Rename, symlink or copy the `rust-analyzer` binary to `rls` and place it somewhere Builder can find (in `PATH`, or under `~/.cargo/bin`). 2691. Rename, symlink or copy the `rust-analyzer` binary to `rls` and place it somewhere Builder can find (in `PATH`, or under `~/.cargo/bin`).
2692. Enable the Rust Builder plugin. 2702. Enable the Rust Builder plugin.
270 271
271== Usage 272== Features
272 273
273See https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/features.md[features.md]. 274include::./generated_features.adoc[]