diff options
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/src/hover.rs | 29 | ||||
-rw-r--r-- | crates/ide/src/references.rs | 9 | ||||
-rw-r--r-- | crates/ide/src/references/rename.rs | 9 |
3 files changed, 47 insertions, 0 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 9a605b09d..20b799490 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -3496,4 +3496,33 @@ mod foo$0; | |||
3496 | "#]], | 3496 | "#]], |
3497 | ); | 3497 | ); |
3498 | } | 3498 | } |
3499 | |||
3500 | #[test] | ||
3501 | fn hover_self_in_use() { | ||
3502 | check( | ||
3503 | r#" | ||
3504 | //! This should not appear | ||
3505 | mod foo { | ||
3506 | /// But this should appear | ||
3507 | pub mod bar {} | ||
3508 | } | ||
3509 | use foo::bar::{self$0}; | ||
3510 | "#, | ||
3511 | expect![[r#" | ||
3512 | *self* | ||
3513 | |||
3514 | ```rust | ||
3515 | test::foo | ||
3516 | ``` | ||
3517 | |||
3518 | ```rust | ||
3519 | pub mod bar | ||
3520 | ``` | ||
3521 | |||
3522 | --- | ||
3523 | |||
3524 | But this should appear | ||
3525 | "#]], | ||
3526 | ); | ||
3527 | } | ||
3499 | } | 3528 | } |
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index 5d0449e56..fef70533d 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs | |||
@@ -39,6 +39,15 @@ pub struct Declaration { | |||
39 | pub access: Option<ReferenceAccess>, | 39 | pub access: Option<ReferenceAccess>, |
40 | } | 40 | } |
41 | 41 | ||
42 | // Feature: Find All References | ||
43 | // | ||
44 | // Shows all references of the item at the cursor location | ||
45 | // | ||
46 | // |=== | ||
47 | // | Editor | Shortcut | ||
48 | // | ||
49 | // | VS Code | kbd:[Shift+Alt+F12] | ||
50 | // |=== | ||
42 | pub(crate) fn find_all_refs( | 51 | pub(crate) fn find_all_refs( |
43 | sema: &Semantics<RootDatabase>, | 52 | sema: &Semantics<RootDatabase>, |
44 | position: FilePosition, | 53 | position: FilePosition, |
diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs index 175ddd759..22ddeeae3 100644 --- a/crates/ide/src/references/rename.rs +++ b/crates/ide/src/references/rename.rs | |||
@@ -59,6 +59,15 @@ pub(crate) fn prepare_rename( | |||
59 | Ok(RangeInfo::new(range, ())) | 59 | Ok(RangeInfo::new(range, ())) |
60 | } | 60 | } |
61 | 61 | ||
62 | // Feature: Rename | ||
63 | // | ||
64 | // Renames the item below the cursor and all of its references | ||
65 | // | ||
66 | // |=== | ||
67 | // | Editor | Shortcut | ||
68 | // | ||
69 | // | VS Code | kbd:[F2] | ||
70 | // |=== | ||
62 | pub(crate) fn rename( | 71 | pub(crate) fn rename( |
63 | db: &RootDatabase, | 72 | db: &RootDatabase, |
64 | position: FilePosition, | 73 | position: FilePosition, |