@@ -143,36 +143,40 @@ pub fn completions(
143
143
db : & RootDatabase ,
144
144
config : & CompletionConfig ,
145
145
position : FilePosition ,
146
+ trigger_character : Option < & str > ,
146
147
) -> Option < Completions > {
147
148
let ctx = & CompletionContext :: new ( db, position, config) ?;
148
149
let mut acc = Completions :: default ( ) ;
149
150
150
151
{
151
152
let acc = & mut acc;
152
- completions:: attribute:: complete_attribute ( acc, ctx) ;
153
- completions:: attribute:: complete_derive ( acc, ctx) ;
154
- completions:: attribute:: complete_known_attribute_input ( acc, ctx) ;
155
- completions:: dot:: complete_dot ( acc, ctx) ;
156
- completions:: expr:: complete_expr_path ( acc, ctx) ;
157
- completions:: extern_abi:: complete_extern_abi ( acc, ctx) ;
158
- completions:: flyimport:: import_on_the_fly ( acc, ctx) ;
159
- completions:: fn_param:: complete_fn_param ( acc, ctx) ;
160
- completions:: format_string:: format_string ( acc, ctx) ;
161
- completions:: item_list:: complete_item_list ( acc, ctx) ;
162
- completions:: keyword:: complete_expr_keyword ( acc, ctx) ;
163
- completions:: lifetime:: complete_label ( acc, ctx) ;
164
- completions:: lifetime:: complete_lifetime ( acc, ctx) ;
165
- completions:: mod_:: complete_mod ( acc, ctx) ;
166
- completions:: pattern:: complete_pattern ( acc, ctx) ;
167
- completions:: postfix:: complete_postfix ( acc, ctx) ;
168
- completions:: record:: complete_record_literal ( acc, ctx) ;
169
- completions:: record:: complete_record ( acc, ctx) ;
170
- completions:: snippet:: complete_expr_snippet ( acc, ctx) ;
171
- completions:: snippet:: complete_item_snippet ( acc, ctx) ;
172
- completions:: trait_impl:: complete_trait_impl ( acc, ctx) ;
173
- completions:: r#type:: complete_type_path ( acc, ctx) ;
174
- completions:: r#type:: complete_inferred_type ( acc, ctx) ;
175
- completions:: use_:: complete_use_tree ( acc, ctx) ;
153
+ // prevent `(` from triggering unwanted completion noise
154
+ if trigger_character != Some ( "(" ) {
155
+ completions:: attribute:: complete_attribute ( acc, ctx) ;
156
+ completions:: attribute:: complete_derive ( acc, ctx) ;
157
+ completions:: attribute:: complete_known_attribute_input ( acc, ctx) ;
158
+ completions:: dot:: complete_dot ( acc, ctx) ;
159
+ completions:: expr:: complete_expr_path ( acc, ctx) ;
160
+ completions:: extern_abi:: complete_extern_abi ( acc, ctx) ;
161
+ completions:: flyimport:: import_on_the_fly ( acc, ctx) ;
162
+ completions:: fn_param:: complete_fn_param ( acc, ctx) ;
163
+ completions:: format_string:: format_string ( acc, ctx) ;
164
+ completions:: item_list:: complete_item_list ( acc, ctx) ;
165
+ completions:: keyword:: complete_expr_keyword ( acc, ctx) ;
166
+ completions:: lifetime:: complete_label ( acc, ctx) ;
167
+ completions:: lifetime:: complete_lifetime ( acc, ctx) ;
168
+ completions:: mod_:: complete_mod ( acc, ctx) ;
169
+ completions:: pattern:: complete_pattern ( acc, ctx) ;
170
+ completions:: postfix:: complete_postfix ( acc, ctx) ;
171
+ completions:: record:: complete_record_literal ( acc, ctx) ;
172
+ completions:: record:: complete_record ( acc, ctx) ;
173
+ completions:: snippet:: complete_expr_snippet ( acc, ctx) ;
174
+ completions:: snippet:: complete_item_snippet ( acc, ctx) ;
175
+ completions:: trait_impl:: complete_trait_impl ( acc, ctx) ;
176
+ completions:: r#type:: complete_type_path ( acc, ctx) ;
177
+ completions:: r#type:: complete_inferred_type ( acc, ctx) ;
178
+ completions:: use_:: complete_use_tree ( acc, ctx) ;
179
+ }
176
180
completions:: vis:: complete_vis_path ( acc, ctx) ;
177
181
}
178
182
0 commit comments