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 /crates/ra_ide | |
parent | 383247a9ae8202f20ce6f01d1429c1cd2a11d516 (diff) |
Generate features docs from source
Diffstat (limited to 'crates/ra_ide')
-rw-r--r-- | crates/ra_ide/src/display/structure.rs | 13 | ||||
-rw-r--r-- | crates/ra_ide/src/extend_selection.rs | 10 | ||||
-rw-r--r-- | crates/ra_ide/src/goto_definition.rs | 9 | ||||
-rw-r--r-- | crates/ra_ide/src/goto_implementation.rs (renamed from crates/ra_ide/src/impls.rs) | 9 | ||||
-rw-r--r-- | crates/ra_ide/src/goto_type_definition.rs | 3 | ||||
-rw-r--r-- | crates/ra_ide/src/lib.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/typing.rs | 7 |
7 files changed, 53 insertions, 2 deletions
diff --git a/crates/ra_ide/src/display/structure.rs b/crates/ra_ide/src/display/structure.rs index 967eee5d2..3f59b89bb 100644 --- a/crates/ra_ide/src/display/structure.rs +++ b/crates/ra_ide/src/display/structure.rs | |||
@@ -18,6 +18,19 @@ pub struct StructureNode { | |||
18 | pub deprecated: bool, | 18 | pub deprecated: bool, |
19 | } | 19 | } |
20 | 20 | ||
21 | // Feature: File Structure | ||
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 | // |=== | ||
30 | // | Editor | Shortcut | ||
31 | // | ||
32 | // | VS Code | kbd:[Ctrl+Shift+O] | ||
33 | // |=== | ||
21 | pub fn file_structure(file: &SourceFile) -> Vec<StructureNode> { | 34 | pub fn file_structure(file: &SourceFile) -> Vec<StructureNode> { |
22 | let mut res = Vec::new(); | 35 | let mut res = Vec::new(); |
23 | let mut stack = Vec::new(); | 36 | let mut stack = Vec::new(); |
diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs index 554594a43..cee0a19e1 100644 --- a/crates/ra_ide/src/extend_selection.rs +++ b/crates/ra_ide/src/extend_selection.rs | |||
@@ -14,6 +14,16 @@ use ra_syntax::{ | |||
14 | 14 | ||
15 | use crate::FileRange; | 15 | use crate::FileRange; |
16 | 16 | ||
17 | // Feature: Extend Selection | ||
18 | // | ||
19 | // Extends the current selection to the encompassing syntactic construct | ||
20 | // (expression, statement, item, module, etc). It works with multiple cursors. | ||
21 | // | ||
22 | // |=== | ||
23 | // | Editor | Shortcut | ||
24 | // | ||
25 | // | VS Code | kbd:[Ctrl+Shift+→] | ||
26 | // |=== | ||
17 | pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRange { | 27 | pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRange { |
18 | let sema = Semantics::new(db); | 28 | let sema = Semantics::new(db); |
19 | let src = sema.parse(frange.file_id); | 29 | let src = sema.parse(frange.file_id); |
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs index 90e85d419..83ea5092c 100644 --- a/crates/ra_ide/src/goto_definition.rs +++ b/crates/ra_ide/src/goto_definition.rs | |||
@@ -17,6 +17,15 @@ use crate::{ | |||
17 | FilePosition, NavigationTarget, RangeInfo, | 17 | FilePosition, NavigationTarget, RangeInfo, |
18 | }; | 18 | }; |
19 | 19 | ||
20 | // Feature: Go To Definition | ||
21 | // | ||
22 | // Navigates to the definition of an identifier. | ||
23 | // | ||
24 | // |=== | ||
25 | // | Editor | Shortcut | ||
26 | // | ||
27 | // | VS Code | kbd:[F12] | ||
28 | // |=== | ||
20 | pub(crate) fn goto_definition( | 29 | pub(crate) fn goto_definition( |
21 | db: &RootDatabase, | 30 | db: &RootDatabase, |
22 | position: FilePosition, | 31 | position: FilePosition, |
diff --git a/crates/ra_ide/src/impls.rs b/crates/ra_ide/src/goto_implementation.rs index ea2225f70..a5a296d22 100644 --- a/crates/ra_ide/src/impls.rs +++ b/crates/ra_ide/src/goto_implementation.rs | |||
@@ -6,6 +6,15 @@ use ra_syntax::{algo::find_node_at_offset, ast, AstNode}; | |||
6 | 6 | ||
7 | use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo}; | 7 | use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo}; |
8 | 8 | ||
9 | // Feature: Go To Implementation | ||
10 | // | ||
11 | // Navigates to the impl block of structs, enums or traits. Also implemented as a code lens. | ||
12 | // | ||
13 | // |=== | ||
14 | // | Editor | Shortcut | ||
15 | // | ||
16 | // | VS Code | kbd:[Ctrl+F12] | ||
17 | // |=== | ||
9 | pub(crate) fn goto_implementation( | 18 | pub(crate) fn goto_implementation( |
10 | db: &RootDatabase, | 19 | db: &RootDatabase, |
11 | position: FilePosition, | 20 | position: FilePosition, |
diff --git a/crates/ra_ide/src/goto_type_definition.rs b/crates/ra_ide/src/goto_type_definition.rs index a84637489..eeadfa9ee 100644 --- a/crates/ra_ide/src/goto_type_definition.rs +++ b/crates/ra_ide/src/goto_type_definition.rs | |||
@@ -5,6 +5,9 @@ use ra_syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffs | |||
5 | 5 | ||
6 | use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo}; | 6 | use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo}; |
7 | 7 | ||
8 | // Feature: Go To Type Definition | ||
9 | // | ||
10 | // Navigates to the type of an identifier. | ||
8 | pub(crate) fn goto_type_definition( | 11 | pub(crate) fn goto_type_definition( |
9 | db: &RootDatabase, | 12 | db: &RootDatabase, |
10 | position: FilePosition, | 13 | position: FilePosition, |
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index d983cd910..12d5716e8 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs | |||
@@ -23,6 +23,7 @@ mod completion; | |||
23 | mod runnables; | 23 | mod runnables; |
24 | mod goto_definition; | 24 | mod goto_definition; |
25 | mod goto_type_definition; | 25 | mod goto_type_definition; |
26 | mod goto_implementation; | ||
26 | mod extend_selection; | 27 | mod extend_selection; |
27 | mod hover; | 28 | mod hover; |
28 | mod call_hierarchy; | 29 | mod call_hierarchy; |
@@ -30,7 +31,6 @@ mod call_info; | |||
30 | mod syntax_highlighting; | 31 | mod syntax_highlighting; |
31 | mod parent_module; | 32 | mod parent_module; |
32 | mod references; | 33 | mod references; |
33 | mod impls; | ||
34 | mod diagnostics; | 34 | mod diagnostics; |
35 | mod syntax_tree; | 35 | mod syntax_tree; |
36 | mod folding_ranges; | 36 | mod folding_ranges; |
@@ -373,7 +373,7 @@ impl Analysis { | |||
373 | &self, | 373 | &self, |
374 | position: FilePosition, | 374 | position: FilePosition, |
375 | ) -> Cancelable<Option<RangeInfo<Vec<NavigationTarget>>>> { | 375 | ) -> Cancelable<Option<RangeInfo<Vec<NavigationTarget>>>> { |
376 | self.with_db(|db| impls::goto_implementation(db, position)) | 376 | self.with_db(|db| goto_implementation::goto_implementation(db, position)) |
377 | } | 377 | } |
378 | 378 | ||
379 | /// Returns the type definitions for the symbol at `position`. | 379 | /// Returns the type definitions for the symbol at `position`. |
diff --git a/crates/ra_ide/src/typing.rs b/crates/ra_ide/src/typing.rs index 39bb3b357..67e2c33a0 100644 --- a/crates/ra_ide/src/typing.rs +++ b/crates/ra_ide/src/typing.rs | |||
@@ -32,6 +32,13 @@ pub(crate) use on_enter::on_enter; | |||
32 | 32 | ||
33 | pub(crate) const TRIGGER_CHARS: &str = ".=>"; | 33 | pub(crate) const TRIGGER_CHARS: &str = ".=>"; |
34 | 34 | ||
35 | // Feature: On Typing Assists | ||
36 | // | ||
37 | // Some features trigger on typing certain characters: | ||
38 | // | ||
39 | // - typing `let =` tries to smartly add `;` if `=` is followed by an existing expression | ||
40 | // - Enter inside comments automatically inserts `///` | ||
41 | // - typing `.` in a chain method call auto-indents | ||
35 | pub(crate) fn on_char_typed( | 42 | pub(crate) fn on_char_typed( |
36 | db: &RootDatabase, | 43 | db: &RootDatabase, |
37 | position: FilePosition, | 44 | position: FilePosition, |