22
33use crate :: {
44 completions:: module_or_fn_macro,
5- context:: { ItemListKind , PathCompletionCtx , PathKind , PathQualifierCtx } ,
5+ context:: { ItemListKind , PathCompletionCtx , PathKind , PathQualifierCtx , Qualified } ,
66 CompletionContext , Completions ,
77} ;
88
@@ -16,23 +16,17 @@ pub(crate) fn complete_item_list(acc: &mut Completions, ctx: &CompletionContext)
1616 return ;
1717 }
1818
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+ }
2823 Some (
2924 ctx @ PathCompletionCtx {
3025 kind : PathKind :: Expr { in_block_expr : true , .. } ,
31- is_absolute_path,
32- qualifier,
26+ qualified,
3327 ..
3428 } ,
35- ) => ( is_absolute_path , qualifier , None , ctx. is_trivial_path ( ) ) ,
29+ ) => ( qualified , None , ctx. is_trivial_path ( ) ) ,
3630 _ => return ,
3731 } ;
3832
@@ -49,8 +43,8 @@ pub(crate) fn complete_item_list(acc: &mut Completions, ctx: &CompletionContext)
4943 return ;
5044 }
5145
52- match path_qualifier {
53- Some ( PathQualifierCtx { resolution, is_super_chain, .. } ) => {
46+ match qualified {
47+ Qualified :: With ( PathQualifierCtx { resolution, is_super_chain, .. } ) => {
5448 if let Some ( hir:: PathResolution :: Def ( hir:: ModuleDef :: Module ( module) ) ) = resolution {
5549 for ( name, def) in module. scope ( ctx. db , Some ( ctx. module ) ) {
5650 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)
6357 acc. add_keyword ( ctx, "super::" ) ;
6458 }
6559 }
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 ( ) => {
6862 ctx. process_all_names ( & mut |name, def| {
6963 if let Some ( def) = module_or_fn_macro ( ctx. db , def) {
7064 acc. add_resolution ( ctx, name, def) ;
7165 }
7266 } ) ;
7367 acc. add_nameref_keywords_with_colon ( ctx) ;
7468 }
75- None => { }
69+ Qualified :: No => { }
7670 }
7771}
7872
0 commit comments