@@ -18,7 +18,7 @@ use syntax::{
1818
1919use crate :: {
2020 completions:: module_or_attr,
21- context:: { CompletionContext , IdentContext , PathCompletionCtx , PathKind , Qualified } ,
21+ context:: { CompletionContext , PathCompletionCtx , PathKind , Qualified } ,
2222 item:: CompletionItem ,
2323 Completions ,
2424} ;
@@ -34,11 +34,9 @@ pub(crate) use self::derive::complete_derive;
3434pub ( crate ) fn complete_known_attribute_input (
3535 acc : & mut Completions ,
3636 ctx : & CompletionContext ,
37+ fake_attribute_under_caret : & ast:: Attr ,
3738) -> Option < ( ) > {
38- let attribute = match & ctx. ident_ctx {
39- IdentContext :: UnexpandedAttrTT { fake_attribute_under_caret : Some ( it) } => it,
40- _ => return None ,
41- } ;
39+ let attribute = fake_attribute_under_caret;
4240 let name_ref = match attribute. path ( ) {
4341 Some ( p) => Some ( p. as_single_name_ref ( ) ?) ,
4442 None => None ,
@@ -71,27 +69,30 @@ pub(crate) fn complete_known_attribute_input(
7169 Some ( ( ) )
7270}
7371
74- pub ( crate ) fn complete_attribute ( acc : & mut Completions , ctx : & CompletionContext ) {
75- let ( qualified, is_inner, annotated_item_kind) = match ctx. path_context ( ) {
76- Some ( & PathCompletionCtx {
72+ pub ( crate ) fn complete_attribute (
73+ acc : & mut Completions ,
74+ ctx : & CompletionContext ,
75+ path_ctx : & PathCompletionCtx ,
76+ ) {
77+ let ( qualified, is_inner, annotated_item_kind) = match path_ctx {
78+ & PathCompletionCtx {
7779 kind : PathKind :: Attr { kind, annotated_item_kind } ,
7880 ref qualified,
7981 ..
80- } ) => ( qualified, kind == AttrKind :: Inner , annotated_item_kind) ,
82+ } => ( qualified, kind == AttrKind :: Inner , annotated_item_kind) ,
8183 _ => return ,
8284 } ;
8385
8486 match qualified {
85- Qualified :: With { resolution, is_super_chain, .. } => {
87+ Qualified :: With {
88+ resolution : Some ( hir:: PathResolution :: Def ( hir:: ModuleDef :: Module ( module) ) ) ,
89+ is_super_chain,
90+ ..
91+ } => {
8692 if * is_super_chain {
8793 acc. add_keyword ( ctx, "super::" ) ;
8894 }
8995
90- let module = match resolution {
91- Some ( hir:: PathResolution :: Def ( hir:: ModuleDef :: Module ( it) ) ) => it,
92- _ => return ,
93- } ;
94-
9596 for ( name, def) in module. scope ( ctx. db , Some ( ctx. module ) ) {
9697 if let Some ( def) = module_or_attr ( ctx. db , def) {
9798 acc. add_resolution ( ctx, name, def) ;
@@ -110,7 +111,7 @@ pub(crate) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext)
110111 } ) ;
111112 acc. add_nameref_keywords_with_colon ( ctx) ;
112113 }
113- Qualified :: Infer => { }
114+ Qualified :: Infer | Qualified :: With { .. } => { }
114115 }
115116
116117 let attributes = annotated_item_kind. and_then ( |kind| {
0 commit comments