Skip to content

Commit f593393

Browse files
committed
Specify actions
1 parent c116171 commit f593393

File tree

7 files changed

+64
-17
lines changed

7 files changed

+64
-17
lines changed

crates/ra_ide/src/goto_definition.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::{
1717
FilePosition, NavigationTarget, RangeInfo,
1818
};
1919

20-
// Feature: Go To Definition
20+
// Feature: Go to Definition
2121
//
2222
// Navigates to the definition of an identifier.
2323
//

crates/ra_ide/src/goto_implementation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use ra_syntax::{algo::find_node_at_offset, ast, AstNode};
66

77
use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo};
88

9-
// Feature: Go To Implementation
9+
// Feature: Go to Implementation
1010
//
1111
// Navigates to the impl block of structs, enums or traits. Also implemented as a code lens.
1212
//

crates/ra_ide/src/goto_type_definition.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ use ra_syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffs
55

66
use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo};
77

8-
// Feature: Go To Type Definition
8+
// Feature: Go to Type Definition
99
//
1010
// Navigates to the type of an identifier.
11+
//
12+
// |===
13+
// | Editor | Action Name
14+
//
15+
// | VS Code | **Go to Type Definition*
16+
// |===
1117
pub(crate) fn goto_type_definition(
1218
db: &RootDatabase,
1319
position: FilePosition,

crates/ra_ide/src/runnables.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ pub enum RunnableKind {
4444
Bin,
4545
}
4646

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+
// |===
4758
pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> {
4859
let sema = Semantics::new(db);
4960
let source_file = sema.parse(file_id);

docs/user/features.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ you can use <kbd>Ctrl+Shift+P</kbd> to search for the corresponding action.
44

55
### Commands <kbd>ctrl+shift+p</kbd>
66

7-
#### Run
8-
9-
Shows a popup suggesting to run a test/benchmark/binary **at the current cursor
10-
location**. Super useful for repeatedly running just a single test. Do bind this
11-
to a shortcut!
12-
137
#### Parent Module
148

159
Navigates to the parent module of the current module.

docs/user/generated_features.adoc

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Provides a tree of the symbols defined in the file. Can be used to
2929
|===
3030

3131

32-
=== Go To Definition
32+
=== Go to Definition
3333
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/goto_definition.rs[goto_definition.rs]
3434

3535

@@ -42,7 +42,7 @@ Navigates to the definition of an identifier.
4242
|===
4343

4444

45-
=== Go To Implementation
45+
=== Go to Implementation
4646
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/goto_implementation.rs[goto_implementation.rs]
4747

4848

@@ -55,12 +55,18 @@ Navigates to the impl block of structs, enums or traits. Also implemented as a c
5555
|===
5656

5757

58-
=== Go To Type Definition
58+
=== Go to Type Definition
5959
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/goto_type_definition.rs[goto_type_definition.rs]
6060

6161

6262
Navigates to the type of an identifier.
6363

64+
|===
65+
| Editor | Action Name
66+
67+
| VS Code | **Go to Type Definition*
68+
|===
69+
6470

6571
=== On Typing Assists
6672
**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:
7379
- typing `.` in a chain method call auto-indents
7480

7581

82+
=== Run
83+
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/runnables.rs[runnables.rs]
84+
85+
86+
Shows a popup suggesting to run a test/benchmark/binary **at the current cursor
87+
location**. Super useful for repeatedly running just a single test. Do bind this
88+
to a shortcut!
89+
90+
|===
91+
| Editor | Action Name
92+
93+
| VS Code | **Rust Analyzer: Run**
94+
|===
95+
96+
7697
=== Workspace Symbol
7798
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide_db/src/symbol_index.rs[symbol_index.rs]
7899

xtask/src/codegen/gen_feature_docs.rs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ impl Feature {
3838

3939
for block in comment_blocks {
4040
let id = block.id;
41-
assert!(
42-
id.split_ascii_whitespace().all(|it| it.starts_with(char::is_uppercase)),
43-
"bad feature: {}",
44-
id
45-
);
41+
assert!(is_valid_feature_name(&id), "invalid feature name: {:?}", id);
4642
let doc = block.contents.join("\n");
4743
acc.push(Feature { id, path: path.clone(), doc })
4844
}
@@ -52,6 +48,25 @@ impl Feature {
5248
}
5349
}
5450

51+
fn 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+
5570
impl fmt::Display for Feature {
5671
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5772
writeln!(f, "=== {}", self.id)?;

0 commit comments

Comments
 (0)