aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_ide/src/goto_definition.rs2
-rw-r--r--crates/ra_ide/src/goto_implementation.rs2
-rw-r--r--crates/ra_ide/src/goto_type_definition.rs8
-rw-r--r--crates/ra_ide/src/runnables.rs11
-rw-r--r--docs/user/features.md6
-rw-r--r--docs/user/generated_features.adoc27
-rw-r--r--xtask/src/codegen/gen_feature_docs.rs25
7 files changed, 64 insertions, 17 deletions
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs
index 83ea5092c..daeeac76f 100644
--- a/crates/ra_ide/src/goto_definition.rs
+++ b/crates/ra_ide/src/goto_definition.rs
@@ -17,7 +17,7 @@ use crate::{
17 FilePosition, NavigationTarget, RangeInfo, 17 FilePosition, NavigationTarget, RangeInfo,
18}; 18};
19 19
20// Feature: Go To Definition 20// Feature: Go to Definition
21// 21//
22// Navigates to the definition of an identifier. 22// Navigates to the definition of an identifier.
23// 23//
diff --git a/crates/ra_ide/src/goto_implementation.rs b/crates/ra_ide/src/goto_implementation.rs
index a5a296d22..622a094e6 100644
--- a/crates/ra_ide/src/goto_implementation.rs
+++ b/crates/ra_ide/src/goto_implementation.rs
@@ -6,7 +6,7 @@ use ra_syntax::{algo::find_node_at_offset, ast, AstNode};
6 6
7use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo}; 7use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo};
8 8
9// Feature: Go To Implementation 9// Feature: Go to Implementation
10// 10//
11// Navigates to the impl block of structs, enums or traits. Also implemented as a code lens. 11// Navigates to the impl block of structs, enums or traits. Also implemented as a code lens.
12// 12//
diff --git a/crates/ra_ide/src/goto_type_definition.rs b/crates/ra_ide/src/goto_type_definition.rs
index eeadfa9ee..e74a502ec 100644
--- a/crates/ra_ide/src/goto_type_definition.rs
+++ b/crates/ra_ide/src/goto_type_definition.rs
@@ -5,9 +5,15 @@ use ra_syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffs
5 5
6use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo}; 6use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo};
7 7
8// Feature: Go To Type Definition 8// Feature: Go to Type Definition
9// 9//
10// Navigates to the type of an identifier. 10// Navigates to the type of an identifier.
11//
12// |===
13// | Editor | Action Name
14//
15// | VS Code | **Go to Type Definition*
16// |===
11pub(crate) fn goto_type_definition( 17pub(crate) fn goto_type_definition(
12 db: &RootDatabase, 18 db: &RootDatabase,
13 position: FilePosition, 19 position: FilePosition,
diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs
index 6e7e47199..4bf2678e1 100644
--- a/crates/ra_ide/src/runnables.rs
+++ b/crates/ra_ide/src/runnables.rs
@@ -44,6 +44,17 @@ pub enum RunnableKind {
44 Bin, 44 Bin,
45} 45}
46 46
47// Feature: Run
48//
49// Shows a popup suggesting to run a test/benchmark/binary **at the current cursor
50// location**. Super useful for repeatedly running just a single test. Do bind this
51// to a shortcut!
52//
53// |===
54// | Editor | Action Name
55//
56// | VS Code | **Rust Analyzer: Run**
57// |===
47pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> { 58pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> {
48 let sema = Semantics::new(db); 59 let sema = Semantics::new(db);
49 let source_file = sema.parse(file_id); 60 let source_file = sema.parse(file_id);
diff --git a/docs/user/features.md b/docs/user/features.md
index 4d9402252..df8e73a20 100644
--- a/docs/user/features.md
+++ b/docs/user/features.md
@@ -4,12 +4,6 @@ you can use <kbd>Ctrl+Shift+P</kbd> to search for the corresponding action.
4 4
5### Commands <kbd>ctrl+shift+p</kbd> 5### Commands <kbd>ctrl+shift+p</kbd>
6 6
7#### Run
8
9Shows a popup suggesting to run a test/benchmark/binary **at the current cursor
10location**. Super useful for repeatedly running just a single test. Do bind this
11to a shortcut!
12
13#### Parent Module 7#### Parent Module
14 8
15Navigates to the parent module of the current module. 9Navigates to the parent module of the current module.
diff --git a/docs/user/generated_features.adoc b/docs/user/generated_features.adoc
index e1eb5d88a..1f6fcc974 100644
--- a/docs/user/generated_features.adoc
+++ b/docs/user/generated_features.adoc
@@ -29,7 +29,7 @@ Provides a tree of the symbols defined in the file. Can be used to
29|=== 29|===
30 30
31 31
32=== Go To Definition 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] 33**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/goto_definition.rs[goto_definition.rs]
34 34
35 35
@@ -42,7 +42,7 @@ Navigates to the definition of an identifier.
42|=== 42|===
43 43
44 44
45=== Go To Implementation 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] 46**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/goto_implementation.rs[goto_implementation.rs]
47 47
48 48
@@ -55,12 +55,18 @@ Navigates to the impl block of structs, enums or traits. Also implemented as a c
55|=== 55|===
56 56
57 57
58=== Go To Type Definition 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] 59**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/goto_type_definition.rs[goto_type_definition.rs]
60 60
61 61
62Navigates to the type of an identifier. 62Navigates to the type of an identifier.
63 63
64|===
65| Editor | Action Name
66
67| VS Code | **Go to Type Definition*
68|===
69
64 70
65=== On Typing Assists 71=== On Typing Assists
66**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/typing.rs[typing.rs] 72**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/typing.rs[typing.rs]
@@ -73,6 +79,21 @@ Some features trigger on typing certain characters:
73- typing `.` in a chain method call auto-indents 79- typing `.` in a chain method call auto-indents
74 80
75 81
82=== Run
83**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/runnables.rs[runnables.rs]
84
85
86Shows a popup suggesting to run a test/benchmark/binary **at the current cursor
87location**. Super useful for repeatedly running just a single test. Do bind this
88to a shortcut!
89
90|===
91| Editor | Action Name
92
93| VS Code | **Rust Analyzer: Run**
94|===
95
96
76=== Workspace Symbol 97=== Workspace Symbol
77**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide_db/src/symbol_index.rs[symbol_index.rs] 98**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide_db/src/symbol_index.rs[symbol_index.rs]
78 99
diff --git a/xtask/src/codegen/gen_feature_docs.rs b/xtask/src/codegen/gen_feature_docs.rs
index 583185648..170a3e889 100644
--- a/xtask/src/codegen/gen_feature_docs.rs
+++ b/xtask/src/codegen/gen_feature_docs.rs
@@ -38,11 +38,7 @@ impl Feature {
38 38
39 for block in comment_blocks { 39 for block in comment_blocks {
40 let id = block.id; 40 let id = block.id;
41 assert!( 41 assert!(is_valid_feature_name(&id), "invalid feature name: {:?}", id);
42 id.split_ascii_whitespace().all(|it| it.starts_with(char::is_uppercase)),
43 "bad feature: {}",
44 id
45 );
46 let doc = block.contents.join("\n"); 42 let doc = block.contents.join("\n");
47 acc.push(Feature { id, path: path.clone(), doc }) 43 acc.push(Feature { id, path: path.clone(), doc })
48 } 44 }
@@ -52,6 +48,25 @@ impl Feature {
52 } 48 }
53} 49}
54 50
51fn is_valid_feature_name(feature: &str) -> bool {
52 'word: for word in feature.split_whitespace() {
53 for &short in ["to"].iter() {
54 if word == short {
55 continue 'word;
56 }
57 }
58 for &short in ["To"].iter() {
59 if word == short {
60 return false;
61 }
62 }
63 if !word.starts_with(char::is_uppercase) {
64 return false;
65 }
66 }
67 true
68}
69
55impl fmt::Display for Feature { 70impl fmt::Display for Feature {
56 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 71 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
57 writeln!(f, "=== {}", self.id)?; 72 writeln!(f, "=== {}", self.id)?;