@@ -57,15 +57,17 @@ impl Completions {
57
57
let kind = match resolution {
58
58
ScopeDef :: ModuleDef ( Module ( ..) ) => CompletionItemKind :: Module ,
59
59
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 ;
61
62
}
62
63
ScopeDef :: ModuleDef ( Adt ( hir:: Adt :: Struct ( _) ) ) => CompletionItemKind :: Struct ,
63
64
// FIXME: add CompletionItemKind::Union
64
65
ScopeDef :: ModuleDef ( Adt ( hir:: Adt :: Union ( _) ) ) => CompletionItemKind :: Struct ,
65
66
ScopeDef :: ModuleDef ( Adt ( hir:: Adt :: Enum ( _) ) ) => CompletionItemKind :: Enum ,
66
67
67
68
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 ;
69
71
}
70
72
ScopeDef :: ModuleDef ( Const ( ..) ) => CompletionItemKind :: Const ,
71
73
ScopeDef :: ModuleDef ( Static ( ..) ) => CompletionItemKind :: Static ,
@@ -77,13 +79,14 @@ impl Completions {
77
79
// (does this need its own kind?)
78
80
ScopeDef :: AdtSelfType ( ..) | ScopeDef :: ImplSelfType ( ..) => CompletionItemKind :: TypeParam ,
79
81
ScopeDef :: MacroDef ( mac) => {
80
- return self . add_macro ( ctx, Some ( local_name) , * mac) ;
82
+ self . add_macro ( ctx, Some ( local_name) , * mac) ;
83
+ return ;
81
84
}
82
85
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 ;
87
90
}
88
91
} ;
89
92
@@ -189,7 +192,7 @@ impl Completions {
189
192
}
190
193
} ;
191
194
192
- self . add ( builder) ;
195
+ self . add ( builder. build ( ) ) ;
193
196
}
194
197
195
198
pub ( crate ) fn add_function (
@@ -241,7 +244,7 @@ impl Completions {
241
244
242
245
builder = builder. add_call_parens ( ctx, name, Params :: Named ( params) ) ;
243
246
244
- self . add ( builder)
247
+ self . add ( builder. build ( ) )
245
248
}
246
249
247
250
pub ( crate ) fn add_const ( & mut self , ctx : & CompletionContext , constant : hir:: Const ) {
0 commit comments