aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir_def/src/path/lower.rs8
-rw-r--r--crates/ra_ide/src/completion/complete_dot.rs39
2 files changed, 45 insertions, 2 deletions
diff --git a/crates/ra_hir_def/src/path/lower.rs b/crates/ra_hir_def/src/path/lower.rs
index 62aafd508..0934520d7 100644
--- a/crates/ra_hir_def/src/path/lower.rs
+++ b/crates/ra_hir_def/src/path/lower.rs
@@ -101,8 +101,12 @@ pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option<Path>
101 break; 101 break;
102 } 102 }
103 ast::PathSegmentKind::SuperKw => { 103 ast::PathSegmentKind::SuperKw => {
104 kind = PathKind::Super(1); 104 let nested_super_count = if let PathKind::Super(n) = kind {
105 break; 105 n
106 } else {
107 0
108 };
109 kind = PathKind::Super(nested_super_count + 1);
106 } 110 }
107 } 111 }
108 path = match qualifier(&path) { 112 path = match qualifier(&path) {
diff --git a/crates/ra_ide/src/completion/complete_dot.rs b/crates/ra_ide/src/completion/complete_dot.rs
index a6e0158b2..9145aa183 100644
--- a/crates/ra_ide/src/completion/complete_dot.rs
+++ b/crates/ra_ide/src/completion/complete_dot.rs
@@ -545,4 +545,43 @@ mod tests {
545 "### 545 "###
546 ) 546 )
547 } 547 }
548
549 #[test]
550 fn test_super_super_completion() {
551 assert_debug_snapshot!(
552 do_ref_completion(
553 r"
554 mod a {
555 const A: usize = 0;
556
557 mod b {
558 const B: usize = 0;
559
560 mod c {
561 use super::super::<|>
562 }
563 }
564 }
565 ",
566 ),
567 @r###"
568 [
569 CompletionItem {
570 label: "A",
571 source_range: [217; 217),
572 delete: [217; 217),
573 insert: "A",
574 kind: Const,
575 },
576 CompletionItem {
577 label: "b",
578 source_range: [217; 217),
579 delete: [217; 217),
580 insert: "b",
581 kind: Module,
582 },
583 ]
584 "###
585 );
586 }
548} 587}