diff options
author | Jonas Schievink <[email protected]> | 2020-12-10 13:16:34 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2020-12-10 13:16:34 +0000 |
commit | f57ce369880f952c97e8a063b5f0fe4abe1d84a4 (patch) | |
tree | aeb3cb34a21785a8d92d2747c059f5d8c47e0c5d /crates | |
parent | 8d5da92e4c779e1222023295c3d29b18eafbdb99 (diff) |
Fix FileId computation in IncorrectCase fix
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ide/src/diagnostics/fixes.rs | 8 |
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 | }; |
11 | use ide_db::base_db::{AnchoredPathBuf, FileId}; | 11 | use ide_db::base_db::{AnchoredPathBuf, FileId}; |
12 | use ide_db::{ | 12 | use 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()?; |