FilePosition, NavigationTarget, RangeInfo,
};
-// Feature: Go To Definition
+// Feature: Go to Definition
//
// Navigates to the definition of an identifier.
//
use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo};
-// Feature: Go To Implementation
+// Feature: Go to Implementation
//
// Navigates to the impl block of structs, enums or traits. Also implemented as a code lens.
//
use crate::{display::ToNav, FilePosition, NavigationTarget, RangeInfo};
-// Feature: Go To Type Definition
+// Feature: Go to Type Definition
//
// Navigates to the type of an identifier.
+//
+// |===
+// | Editor | Action Name
+//
+// | VS Code | **Go to Type Definition*
+// |===
pub(crate) fn goto_type_definition(
db: &RootDatabase,
position: FilePosition,
Bin,
}
+// Feature: Run
+//
+// Shows a popup suggesting to run a test/benchmark/binary **at the current cursor
+// location**. Super useful for repeatedly running just a single test. Do bind this
+// to a shortcut!
+//
+// |===
+// | Editor | Action Name
+//
+// | VS Code | **Rust Analyzer: Run**
+// |===
pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> {
let sema = Semantics::new(db);
let source_file = sema.parse(file_id);
### Commands <kbd>ctrl+shift+p</kbd>
-#### Run
-
-Shows a popup suggesting to run a test/benchmark/binary **at the current cursor
-location**. Super useful for repeatedly running just a single test. Do bind this
-to a shortcut!
-
#### Parent Module
Navigates to the parent module of the current module.
|===
-=== Go To Definition
+=== Go to Definition
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/goto_definition.rs[goto_definition.rs]
|===
-=== Go To Implementation
+=== Go to Implementation
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/goto_implementation.rs[goto_implementation.rs]
|===
-=== Go To Type Definition
+=== Go to Type Definition
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/goto_type_definition.rs[goto_type_definition.rs]
Navigates to the type of an identifier.
+|===
+| Editor | Action Name
+
+| VS Code | **Go to Type Definition*
+|===
+
=== On Typing Assists
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/typing.rs[typing.rs]
- typing `.` in a chain method call auto-indents
+=== Run
+**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/runnables.rs[runnables.rs]
+
+
+Shows a popup suggesting to run a test/benchmark/binary **at the current cursor
+location**. Super useful for repeatedly running just a single test. Do bind this
+to a shortcut!
+
+|===
+| Editor | Action Name
+
+| VS Code | **Rust Analyzer: Run**
+|===
+
+
=== Workspace Symbol
**Source:** https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide_db/src/symbol_index.rs[symbol_index.rs]
for block in comment_blocks {
let id = block.id;
- assert!(
- id.split_ascii_whitespace().all(|it| it.starts_with(char::is_uppercase)),
- "bad feature: {}",
- id
- );
+ assert!(is_valid_feature_name(&id), "invalid feature name: {:?}", id);
let doc = block.contents.join("\n");
acc.push(Feature { id, path: path.clone(), doc })
}
}
}
+fn is_valid_feature_name(feature: &str) -> bool {
+ 'word: for word in feature.split_whitespace() {
+ for &short in ["to"].iter() {
+ if word == short {
+ continue 'word;
+ }
+ }
+ for &short in ["To"].iter() {
+ if word == short {
+ return false;
+ }
+ }
+ if !word.starts_with(char::is_uppercase) {
+ return false;
+ }
+ }
+ true
+}
+
impl fmt::Display for Feature {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
writeln!(f, "=== {}", self.id)?;