mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-27 06:14:55 +00:00
fix completion for super::super::
This commit is contained in:
parent
69faf81e0d
commit
0057d1e10d
@ -101,8 +101,12 @@ pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option<Path>
|
||||
break;
|
||||
}
|
||||
ast::PathSegmentKind::SuperKw => {
|
||||
kind = PathKind::Super(1);
|
||||
break;
|
||||
let nested_super_count = if let PathKind::Super(n) = kind {
|
||||
n
|
||||
} else {
|
||||
0
|
||||
};
|
||||
kind = PathKind::Super(nested_super_count + 1);
|
||||
}
|
||||
}
|
||||
path = match qualifier(&path) {
|
||||
|
@ -545,4 +545,43 @@ mod tests {
|
||||
"###
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_super_super_completion() {
|
||||
assert_debug_snapshot!(
|
||||
do_ref_completion(
|
||||
r"
|
||||
mod a {
|
||||
const A: usize = 0;
|
||||
|
||||
mod b {
|
||||
const B: usize = 0;
|
||||
|
||||
mod c {
|
||||
use super::super::<|>
|
||||
}
|
||||
}
|
||||
}
|
||||
",
|
||||
),
|
||||
@r###"
|
||||
[
|
||||
CompletionItem {
|
||||
label: "A",
|
||||
source_range: [217; 217),
|
||||
delete: [217; 217),
|
||||
insert: "A",
|
||||
kind: Const,
|
||||
},
|
||||
CompletionItem {
|
||||
label: "b",
|
||||
source_range: [217; 217),
|
||||
delete: [217; 217),
|
||||
insert: "b",
|
||||
kind: Module,
|
||||
},
|
||||
]
|
||||
"###
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user