aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/diagnostics
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-12-10 13:16:34 +0000
committerJonas Schievink <[email protected]>2020-12-10 13:16:34 +0000
commitf57ce369880f952c97e8a063b5f0fe4abe1d84a4 (patch)
treeaeb3cb34a21785a8d92d2747c059f5d8c47e0c5d /crates/ide/src/diagnostics
parent8d5da92e4c779e1222023295c3d29b18eafbdb99 (diff)
Fix FileId computation in IncorrectCase fix
Diffstat (limited to 'crates/ide/src/diagnostics')
-rw-r--r--crates/ide/src/diagnostics/fixes.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs
index 29c7a040b..a900d7bae 100644
--- a/crates/ide/src/diagnostics/fixes.rs
+++ b/crates/ide/src/diagnostics/fixes.rs
@@ -6,7 +6,7 @@ use hir::{
6 Diagnostic, IncorrectCase, MissingFields, MissingOkInTailExpr, NoSuchField, 6 Diagnostic, IncorrectCase, MissingFields, MissingOkInTailExpr, NoSuchField,
7 UnresolvedModule, 7 UnresolvedModule,
8 }, 8 },
9 HasSource, HirDisplay, Semantics, VariantDef, 9 HasSource, HirDisplay, InFile, Semantics, VariantDef,
10}; 10};
11use ide_db::base_db::{AnchoredPathBuf, FileId}; 11use ide_db::base_db::{AnchoredPathBuf, FileId};
12use ide_db::{ 12use ide_db::{
@@ -110,9 +110,9 @@ impl DiagnosticWithFix for IncorrectCase {
110 let root = sema.db.parse_or_expand(self.file)?; 110 let root = sema.db.parse_or_expand(self.file)?;
111 let name_node = self.ident.to_node(&root); 111 let name_node = self.ident.to_node(&root);
112 112
113 let file_id = self.file.original_file(sema.db); 113 let name_node = InFile::new(self.file, name_node.syntax());
114 let offset = name_node.syntax().text_range().start(); 114 let frange = name_node.original_file_range(sema.db);
115 let file_position = FilePosition { file_id, offset }; 115 let file_position = FilePosition { file_id: frange.file_id, offset: frange.range.start() };
116 116
117 let rename_changes = 117 let rename_changes =
118 rename_with_semantics(sema, file_position, &self.suggested_text).ok()?; 118 rename_with_semantics(sema, file_position, &self.suggested_text).ok()?;