Skip to content

Commit 8fbaa8e

Browse files
bors[bot]Veykril
andauthored
Merge #6775
6775: Fix MissingFields DiagnosticFix trigger range r=lnicola a=Veykril Fixes #5950 Co-authored-by: Lukas Wirth <[email protected]>
2 parents cd83ded + 1d54c49 commit 8fbaa8e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crates/ide/src/diagnostics/fixes.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ impl DiagnosticWithFix for MissingFields {
6868
}
6969

7070
let root = sema.db.parse_or_expand(self.file)?;
71-
let old_field_list = self.field_list_parent.to_node(&root).record_expr_field_list()?;
71+
let field_list_parent = self.field_list_parent.to_node(&root);
72+
let old_field_list = field_list_parent.record_expr_field_list()?;
7273
let mut new_field_list = old_field_list.clone();
7374
for f in self.missed_fields.iter() {
7475
let field =
@@ -85,7 +86,7 @@ impl DiagnosticWithFix for MissingFields {
8586
Some(Fix::new(
8687
"Fill struct fields",
8788
SourceFileEdit { file_id: self.file.original_file(sema.db), edit }.into(),
88-
sema.original_range(&old_field_list.syntax()).range,
89+
sema.original_range(&field_list_parent.syntax()).range,
8990
))
9091
}
9192
}

0 commit comments

Comments
 (0)