diff options
author | ShuiRuTian <[email protected]> | 2021-01-11 06:45:35 +0000 |
---|---|---|
committer | ShuiRuTian <[email protected]> | 2021-01-11 06:45:35 +0000 |
commit | f7cb9e9fbe50e5d0e23e81b8b5b90405ef5c1931 (patch) | |
tree | 147a80040e3513a0be3f6fb4c59a6d0dd1a0ecee /crates | |
parent | b9d52444cf621e474e0117e70c335dde2cbf3515 (diff) |
move logic from client to server.
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/src/handlers.rs | 10 |
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()?, |