aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/diagnostics
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-12-09 12:12:43 +0000
committerGitHub <[email protected]>2020-12-09 12:12:43 +0000
commit8fbaa8e49560b69f9017ebbced4a6571c2fbc64f (patch)
tree09ed00c60f7e66d3c5384dc239e77df414f76f3a /crates/ide/src/diagnostics
parentcd83ded8ee89e79d6b446518c3d74f6c18f8f5d9 (diff)
parent1d54c49271af29814d9b380edee824cb4493c454 (diff)
Merge #6775
6775: Fix MissingFields DiagnosticFix trigger range r=lnicola a=Veykril Fixes #5950 Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide/src/diagnostics')
-rw-r--r--crates/ide/src/diagnostics/fixes.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs
index d275dd75b..24d08651e 100644
--- a/crates/ide/src/diagnostics/fixes.rs
+++ b/crates/ide/src/diagnostics/fixes.rs
@@ -68,7 +68,8 @@ impl DiagnosticWithFix for MissingFields {
68 } 68 }
69 69
70 let root = sema.db.parse_or_expand(self.file)?; 70 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()?;
72 let mut new_field_list = old_field_list.clone(); 73 let mut new_field_list = old_field_list.clone();
73 for f in self.missed_fields.iter() { 74 for f in self.missed_fields.iter() {
74 let field = 75 let field =
@@ -85,7 +86,7 @@ impl DiagnosticWithFix for MissingFields {
85 Some(Fix::new( 86 Some(Fix::new(
86 "Fill struct fields", 87 "Fill struct fields",
87 SourceFileEdit { file_id: self.file.original_file(sema.db), edit }.into(), 88 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,
89 )) 90 ))
90 } 91 }
91} 92}