@@ -57,15 +57,17 @@ impl Completions {
5757 let kind = match resolution {
5858 ScopeDef :: ModuleDef ( Module ( ..) ) => CompletionItemKind :: Module ,
5959 ScopeDef :: ModuleDef ( Function ( func) ) => {
60- return self . add_function ( ctx, * func, Some ( local_name) ) ;
60+ self . add_function ( ctx, * func, Some ( local_name) ) ;
61+ return ;
6162 }
6263 ScopeDef :: ModuleDef ( Adt ( hir:: Adt :: Struct ( _) ) ) => CompletionItemKind :: Struct ,
6364 // FIXME: add CompletionItemKind::Union
6465 ScopeDef :: ModuleDef ( Adt ( hir:: Adt :: Union ( _) ) ) => CompletionItemKind :: Struct ,
6566 ScopeDef :: ModuleDef ( Adt ( hir:: Adt :: Enum ( _) ) ) => CompletionItemKind :: Enum ,
6667
6768 ScopeDef :: ModuleDef ( EnumVariant ( var) ) => {
68- return self . add_enum_variant ( ctx, * var, Some ( local_name) ) ;
69+ self . add_enum_variant ( ctx, * var, Some ( local_name) ) ;
70+ return ;
6971 }
7072 ScopeDef :: ModuleDef ( Const ( ..) ) => CompletionItemKind :: Const ,
7173 ScopeDef :: ModuleDef ( Static ( ..) ) => CompletionItemKind :: Static ,
@@ -77,13 +79,14 @@ impl Completions {
7779 // (does this need its own kind?)
7880 ScopeDef :: AdtSelfType ( ..) | ScopeDef :: ImplSelfType ( ..) => CompletionItemKind :: TypeParam ,
7981 ScopeDef :: MacroDef ( mac) => {
80- return self . add_macro ( ctx, Some ( local_name) , * mac) ;
82+ self . add_macro ( ctx, Some ( local_name) , * mac) ;
83+ return ;
8184 }
8285 ScopeDef :: Unknown => {
83- return self . add (
84- CompletionItem :: new ( CompletionKind :: Reference , ctx . source_range ( ) , local_name )
85- . kind ( CompletionItemKind :: UnresolvedReference ) ,
86- ) ;
86+ CompletionItem :: new ( CompletionKind :: Reference , ctx . source_range ( ) , local_name )
87+ . kind ( CompletionItemKind :: UnresolvedReference )
88+ . add_to ( self ) ;
89+ return ;
8790 }
8891 } ;
8992
@@ -189,7 +192,7 @@ impl Completions {
189192 }
190193 } ;
191194
192- self . add ( builder) ;
195+ self . add ( builder. build ( ) ) ;
193196 }
194197
195198 pub ( crate ) fn add_function (
@@ -241,7 +244,7 @@ impl Completions {
241244
242245 builder = builder. add_call_parens ( ctx, name, Params :: Named ( params) ) ;
243246
244- self . add ( builder)
247+ self . add ( builder. build ( ) )
245248 }
246249
247250 pub ( crate ) fn add_const ( & mut self , ctx : & CompletionContext , constant : hir:: Const ) {
0 commit comments