2
2
3
3
use crate :: {
4
4
completions:: module_or_fn_macro,
5
- context:: { ItemListKind , PathCompletionCtx , PathKind , PathQualifierCtx } ,
5
+ context:: { ItemListKind , PathCompletionCtx , PathKind , PathQualifierCtx , Qualified } ,
6
6
CompletionContext , Completions ,
7
7
} ;
8
8
@@ -16,23 +16,17 @@ pub(crate) fn complete_item_list(acc: &mut Completions, ctx: &CompletionContext)
16
16
return ;
17
17
}
18
18
19
- let ( & is_absolute_path, path_qualifier, kind, is_trivial_path) = match ctx. path_context ( ) {
20
- Some (
21
- ctx @ PathCompletionCtx {
22
- kind : PathKind :: Item { kind } ,
23
- is_absolute_path,
24
- qualifier,
25
- ..
26
- } ,
27
- ) => ( is_absolute_path, qualifier, Some ( kind) , ctx. is_trivial_path ( ) ) ,
19
+ let ( qualified, kind, is_trivial_path) = match ctx. path_context ( ) {
20
+ Some ( ctx @ PathCompletionCtx { kind : PathKind :: Item { kind } , qualified, .. } ) => {
21
+ ( qualified, Some ( kind) , ctx. is_trivial_path ( ) )
22
+ }
28
23
Some (
29
24
ctx @ PathCompletionCtx {
30
25
kind : PathKind :: Expr { in_block_expr : true , .. } ,
31
- is_absolute_path,
32
- qualifier,
26
+ qualified,
33
27
..
34
28
} ,
35
- ) => ( is_absolute_path , qualifier , None , ctx. is_trivial_path ( ) ) ,
29
+ ) => ( qualified , None , ctx. is_trivial_path ( ) ) ,
36
30
_ => return ,
37
31
} ;
38
32
@@ -49,8 +43,8 @@ pub(crate) fn complete_item_list(acc: &mut Completions, ctx: &CompletionContext)
49
43
return ;
50
44
}
51
45
52
- match path_qualifier {
53
- Some ( PathQualifierCtx { resolution, is_super_chain, .. } ) => {
46
+ match qualified {
47
+ Qualified :: With ( PathQualifierCtx { resolution, is_super_chain, .. } ) => {
54
48
if let Some ( hir:: PathResolution :: Def ( hir:: ModuleDef :: Module ( module) ) ) = resolution {
55
49
for ( name, def) in module. scope ( ctx. db , Some ( ctx. module ) ) {
56
50
if let Some ( def) = module_or_fn_macro ( ctx. db , def) {
@@ -63,16 +57,16 @@ pub(crate) fn complete_item_list(acc: &mut Completions, ctx: &CompletionContext)
63
57
acc. add_keyword ( ctx, "super::" ) ;
64
58
}
65
59
}
66
- None if is_absolute_path => acc. add_crate_roots ( ctx) ,
67
- None if ctx. qualifier_ctx . none ( ) => {
60
+ Qualified :: Absolute => acc. add_crate_roots ( ctx) ,
61
+ Qualified :: No if ctx. qualifier_ctx . none ( ) => {
68
62
ctx. process_all_names ( & mut |name, def| {
69
63
if let Some ( def) = module_or_fn_macro ( ctx. db , def) {
70
64
acc. add_resolution ( ctx, name, def) ;
71
65
}
72
66
} ) ;
73
67
acc. add_nameref_keywords_with_colon ( ctx) ;
74
68
}
75
- None => { }
69
+ Qualified :: No => { }
76
70
}
77
71
}
78
72
0 commit comments