diff options
Diffstat (limited to 'crates/ra_assists')
-rw-r--r-- | crates/ra_assists/src/assists/add_import.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/ra_assists/src/assists/add_import.rs b/crates/ra_assists/src/assists/add_import.rs index f81b4184a..ceffee9b8 100644 --- a/crates/ra_assists/src/assists/add_import.rs +++ b/crates/ra_assists/src/assists/add_import.rs | |||
@@ -582,8 +582,14 @@ fn collect_hir_path_segments(path: &hir::Path) -> Option<Vec<SmolStr>> { | |||
582 | hir::PathKind::Abs => ps.push("".into()), | 582 | hir::PathKind::Abs => ps.push("".into()), |
583 | hir::PathKind::Crate => ps.push("crate".into()), | 583 | hir::PathKind::Crate => ps.push("crate".into()), |
584 | hir::PathKind::Plain => {} | 584 | hir::PathKind::Plain => {} |
585 | hir::PathKind::Self_ => ps.push("self".into()), | 585 | hir::PathKind::Super(0) => ps.push("self".into()), |
586 | hir::PathKind::Super => ps.push("super".into()), | 586 | hir::PathKind::Super(lvl) => { |
587 | let mut chain = "super".to_string(); | ||
588 | for _ in 0..*lvl { | ||
589 | chain += "::super"; | ||
590 | } | ||
591 | ps.push(chain.into()); | ||
592 | } | ||
587 | hir::PathKind::Type(_) | hir::PathKind::DollarCrate(_) => return None, | 593 | hir::PathKind::Type(_) | hir::PathKind::DollarCrate(_) => return None, |
588 | } | 594 | } |
589 | ps.extend(path.segments().iter().map(|it| it.name.to_string().into())); | 595 | ps.extend(path.segments().iter().map(|it| it.name.to_string().into())); |