From 8915183d7da07a4b295e5e93a889dea4c15024a0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 31 May 2020 09:59:38 +0200 Subject: Don't require module docs for Features and Assists --- docs/user/assists.md | 18 +++++++++++++ docs/user/features.md | 16 ------------ docs/user/generated_features.adoc | 55 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 16 deletions(-) (limited to 'docs/user') 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() { } ``` +## `add_from_impl_for_enum` + +Adds a From impl for an enum variant with one tuple field. + +```rust +// BEFORE +enum A { ┃One(u32) } + +// AFTER +enum A { One(u32) } + +impl From for A { + fn from(v: u32) -> Self { + A::One(v) + } +} +``` + ## `add_function` 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 Ctrl+Shift+P to search for the corresponding action. ### Commands ctrl+shift+p -#### Parent Module -Navigates to the parent module of the current module. -#### Matching Brace - -If the cursor is on any brace (`<>(){}[]`) which is a part of a brace-pair, -moves cursor to the matching brace. It uses the actual parser to determine -braces, so it won't confuse generics with comparisons. - -#### Join Lines - -Join selected lines into one, smartly fixing up whitespace and trailing commas. - -#### Show Syntax Tree - -Shows the parse tree of the current file. It exists mostly for debugging -rust-analyzer itself. #### Expand Macro Recursively 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. |=== +=== Join Lines +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/join_lines.rs[join_lines.rs] + + +Join selected lines into one, smartly fixing up whitespace, trailing commas, and braces. + +|=== +| Editor | Action Name + +| VS Code | **Rust Analyzer: Join lines** +|=== + + +=== Matching Brace +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/matching_brace.rs[matching_brace.rs] + + +If the cursor is on any brace (`<>(){}[]`) which is a part of a brace-pair, +moves cursor to the matching brace. It uses the actual parser to determine +braces, so it won't confuse generics with comparisons. + +|=== +| Editor | Action Name + +| VS Code | **Rust Analyzer: Find matching brace** +|=== + + === On Typing Assists **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/typing.rs[typing.rs] @@ -79,6 +107,19 @@ Some features trigger on typing certain characters: - typing `.` in a chain method call auto-indents +=== Parent Module +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/parent_module.rs[parent_module.rs] + + +Navigates to the parent module of the current module. + +|=== +| Editor | Action Name + +| VS Code | **Rust Analyzer: Locate parent module** +|=== + + === Run **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/runnables.rs[runnables.rs] @@ -94,6 +135,20 @@ to a shortcut! |=== +=== Show Syntax Tree +**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/syntax_tree.rs[syntax_tree.rs] + + +Shows the parse tree of the current file. It exists mostly for debugging +rust-analyzer itself. + +|=== +| Editor | Action Name + +| VS Code | **Rust Analyzer: Show Syntax Tree** +|=== + + === Workspace Symbol **Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide_db/src/symbol_index.rs[symbol_index.rs] -- cgit v1.2.3