diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/completion/src/completions/record.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/completion/src/completions/record.rs b/crates/completion/src/completions/record.rs index 91bf4a8ad..8f904adfd 100644 --- a/crates/completion/src/completions/record.rs +++ b/crates/completion/src/completions/record.rs | |||
@@ -20,13 +20,18 @@ pub(crate) fn complete_record(acc: &mut Completions, ctx: &CompletionContext) -> | |||
20 | 20 | ||
21 | let missing_fields = ctx.sema.record_literal_missing_fields(record_lit); | 21 | let missing_fields = ctx.sema.record_literal_missing_fields(record_lit); |
22 | if impl_default_trait && !missing_fields.is_empty() { | 22 | if impl_default_trait && !missing_fields.is_empty() { |
23 | let completion_text = if ctx.token.to_string() == "." { | ||
24 | ".Default::default()" | ||
25 | } else { | ||
26 | "..Default::default()" | ||
27 | }; | ||
23 | acc.add( | 28 | acc.add( |
24 | CompletionItem::new( | 29 | CompletionItem::new( |
25 | CompletionKind::Snippet, | 30 | CompletionKind::Snippet, |
26 | ctx.source_range(), | 31 | ctx.source_range(), |
27 | "..Default::default()", | 32 | "..Default::default()", |
28 | ) | 33 | ) |
29 | .insert_text("..Default::default()") | 34 | .insert_text(completion_text) |
30 | .kind(CompletionItemKind::Field) | 35 | .kind(CompletionItemKind::Field) |
31 | .build(), | 36 | .build(), |
32 | ); | 37 | ); |