feat: allow moving nonexistent file (#13748)

pull/13617/merge
Tatesa Uradnik 2025-06-16 15:19:28 +02:00 committed by GitHub
parent 1246549afd
commit 837627dd8a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -1437,7 +1437,11 @@ impl Editor {
log::error!("failed to apply workspace edit: {err:?}")
}
}
fs::rename(old_path, &new_path)?;
if old_path.exists() {
fs::rename(old_path, &new_path)?;
}
if let Some(doc) = self.document_by_path(old_path) {
self.set_doc_path(doc.id(), &new_path);
}