aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/imp.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-12-21 09:33:45 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-12-21 09:33:45 +0000
commit4f7ec0170353e61c148909d2716c915578392a7b (patch)
treec4a7a0dae2ccbc6b6d987faca8002a22d0253382 /crates/ra_analysis/src/imp.rs
parent164d53b22f345e50c67781af545310d2193e8a5c (diff)
parentfd927ea3a9ea687ba11b01e56579f0287221f55c (diff)
Merge #309
309: Fix edits r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_analysis/src/imp.rs')
-rw-r--r--crates/ra_analysis/src/imp.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs
index cefe5a748..5701e1ae2 100644
--- a/crates/ra_analysis/src/imp.rs
+++ b/crates/ra_analysis/src/imp.rs
@@ -368,10 +368,11 @@ impl AnalysisImpl {
368 .collect::<Vec<_>>(); 368 .collect::<Vec<_>>();
369 if let Some(m) = source_binder::module_from_file_id(&*self.db, file_id)? { 369 if let Some(m) = source_binder::module_from_file_id(&*self.db, file_id)? {
370 for (name_node, problem) in m.problems(&*self.db) { 370 for (name_node, problem) in m.problems(&*self.db) {
371 let source_root = self.db.file_source_root(file_id);
371 let diag = match problem { 372 let diag = match problem {
372 Problem::UnresolvedModule { candidate } => { 373 Problem::UnresolvedModule { candidate } => {
373 let create_file = FileSystemEdit::CreateFile { 374 let create_file = FileSystemEdit::CreateFile {
374 anchor: file_id, 375 source_root,
375 path: candidate.clone(), 376 path: candidate.clone(),
376 }; 377 };
377 let fix = SourceChange { 378 let fix = SourceChange {
@@ -388,11 +389,12 @@ impl AnalysisImpl {
388 } 389 }
389 Problem::NotDirOwner { move_to, candidate } => { 390 Problem::NotDirOwner { move_to, candidate } => {
390 let move_file = FileSystemEdit::MoveFile { 391 let move_file = FileSystemEdit::MoveFile {
391 file: file_id, 392 src: file_id,
392 path: move_to.clone(), 393 dst_source_root: source_root,
394 dst_path: move_to.clone(),
393 }; 395 };
394 let create_file = FileSystemEdit::CreateFile { 396 let create_file = FileSystemEdit::CreateFile {
395 anchor: file_id, 397 source_root,
396 path: move_to.join(candidate), 398 path: move_to.join(candidate),
397 }; 399 };
398 let fix = SourceChange { 400 let fix = SourceChange {
@@ -520,7 +522,7 @@ impl SourceChange {
520 pub(crate) fn from_local_edit(file_id: FileId, label: &str, edit: LocalEdit) -> SourceChange { 522 pub(crate) fn from_local_edit(file_id: FileId, label: &str, edit: LocalEdit) -> SourceChange {
521 let file_edit = SourceFileEdit { 523 let file_edit = SourceFileEdit {
522 file_id, 524 file_id,
523 edits: edit.edit.into_atoms(), 525 edit: edit.edit,
524 }; 526 };
525 SourceChange { 527 SourceChange {
526 label: label.to_string(), 528 label: label.to_string(),