aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/handlers.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs
index 1aafef78b..17f67d4b7 100644
--- a/crates/rust-analyzer/src/handlers.rs
+++ b/crates/rust-analyzer/src/handlers.rs
@@ -435,7 +435,15 @@ pub(crate) fn handle_will_rename_files(
435 if from_path.is_dir() { 435 if from_path.is_dir() {
436 // This is a quick implement, try to use will_rename_file code. 436 // This is a quick implement, try to use will_rename_file code.
437 // imitate change the older_folder/mod.rs to older_folder/new_folder.rs 437 // imitate change the older_folder/mod.rs to older_folder/new_folder.rs
438 let imitate_from_url = from.join("mod.rs").ok()?; 438
439 // add '/' to end of url -- from `file://path/to/folder` to `file://path/to/folder/`
440 let old_folder_name = from_path.file_stem()?;
441 let old_folder_name = old_folder_name.to_str()?;
442 let mut old_folder_name = old_folder_name.to_string();
443 old_folder_name.push('/');
444 let from_with_trailing_slash = from.join(&old_folder_name).ok()?;
445
446 let imitate_from_url = from_with_trailing_slash.join("mod.rs").ok()?;
439 let imite_new_file_name = to_path.file_name()?.to_str()?; 447 let imite_new_file_name = to_path.file_name()?.to_str()?;
440 Some(( 448 Some((
441 snap.url_to_file_id(&imitate_from_url).ok()?, 449 snap.url_to_file_id(&imitate_from_url).ok()?,