diff options
Diffstat (limited to 'crates/completion/src')
-rw-r--r-- | crates/completion/src/completions/record.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/completion/src/completions/record.rs b/crates/completion/src/completions/record.rs index f55ae11e6..e58b9a274 100644 --- a/crates/completion/src/completions/record.rs +++ b/crates/completion/src/completions/record.rs | |||
@@ -20,11 +20,10 @@ 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() == "." { | 23 | let completion_text = "..Default::default()"; |
24 | ".Default::default()" | 24 | let completion_text = completion_text |
25 | } else { | 25 | .strip_prefix(ctx.token.to_string().as_str()) |
26 | "..Default::default()" | 26 | .unwrap_or(completion_text); |
27 | }; | ||
28 | acc.add( | 27 | acc.add( |
29 | CompletionItem::new( | 28 | CompletionItem::new( |
30 | CompletionKind::Snippet, | 29 | CompletionKind::Snippet, |