mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Fix FileId computation in IncorrectCase fix
This commit is contained in:
parent
8d5da92e4c
commit
f57ce36988
1 changed files with 4 additions and 4 deletions
|
@ -6,7 +6,7 @@ use hir::{
|
||||||
Diagnostic, IncorrectCase, MissingFields, MissingOkInTailExpr, NoSuchField,
|
Diagnostic, IncorrectCase, MissingFields, MissingOkInTailExpr, NoSuchField,
|
||||||
UnresolvedModule,
|
UnresolvedModule,
|
||||||
},
|
},
|
||||||
HasSource, HirDisplay, Semantics, VariantDef,
|
HasSource, HirDisplay, InFile, Semantics, VariantDef,
|
||||||
};
|
};
|
||||||
use ide_db::base_db::{AnchoredPathBuf, FileId};
|
use ide_db::base_db::{AnchoredPathBuf, FileId};
|
||||||
use ide_db::{
|
use ide_db::{
|
||||||
|
@ -110,9 +110,9 @@ impl DiagnosticWithFix for IncorrectCase {
|
||||||
let root = sema.db.parse_or_expand(self.file)?;
|
let root = sema.db.parse_or_expand(self.file)?;
|
||||||
let name_node = self.ident.to_node(&root);
|
let name_node = self.ident.to_node(&root);
|
||||||
|
|
||||||
let file_id = self.file.original_file(sema.db);
|
let name_node = InFile::new(self.file, name_node.syntax());
|
||||||
let offset = name_node.syntax().text_range().start();
|
let frange = name_node.original_file_range(sema.db);
|
||||||
let file_position = FilePosition { file_id, offset };
|
let file_position = FilePosition { file_id: frange.file_id, offset: frange.range.start() };
|
||||||
|
|
||||||
let rename_changes =
|
let rename_changes =
|
||||||
rename_with_semantics(sema, file_position, &self.suggested_text).ok()?;
|
rename_with_semantics(sema, file_position, &self.suggested_text).ok()?;
|
||||||
|
|
Loading…
Reference in a new issue