Skip to content

Commit 62837d7

Browse files
bors[bot]Veykril
andauthored
Merge #9976
9976: fix: Do not show functional update completion when already qualified r=Veykril a=Veykril Fixes #9964 bors r+ Co-authored-by: Lukas Wirth <[email protected]>
2 parents 9e3517f + 833de22 commit 62837d7

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

crates/ide_completion/src/completions/record.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub(crate) fn complete_record(acc: &mut Completions, ctx: &CompletionContext) ->
2020
});
2121

2222
let missing_fields = ctx.sema.record_literal_missing_fields(record_expr);
23-
if impl_default_trait && !missing_fields.is_empty() {
23+
if impl_default_trait && !missing_fields.is_empty() && ctx.path_qual().is_none() {
2424
let completion_text = "..Default::default()";
2525
let mut item = CompletionItem::new(
2626
CompletionKind::Snippet,

crates/ide_completion/src/tests/record.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,24 @@ fn main() {
182182
sn Foo {…} Foo { foo1: ${1:()}, foo2: ${2:()} }$0
183183
"#]],
184184
);
185+
check(
186+
r#"
187+
//- minicore:default
188+
struct Foo { foo1: u32, foo2: u32 }
189+
impl Default for Foo {
190+
fn default() -> Self { loop {} }
191+
}
192+
193+
fn main() {
194+
let thing = 1;
195+
let foo = Foo { foo1: 0, foo2: 0 };
196+
let foo2 = Foo { thing, ..Default::$0 }
197+
}
198+
"#,
199+
expect![[r#"
200+
fn default() (as Default) fn() -> Self
201+
fd foo1 u32
202+
fd foo2 u32
203+
"#]],
204+
);
185205
}

0 commit comments

Comments
 (0)