Skip to content

Commit c9d9e4c

Browse files
committed
Don't return a SourceChange on WillRenameFiles when nothing gets refactored
1 parent d849124 commit c9d9e4c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

crates/rust-analyzer/src/handlers.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,11 @@ pub(crate) fn handle_will_rename_files(
465465
source_change.file_system_edits.clear();
466466
// no collect here because we want to merge text edits on same file ids
467467
source_change.extend(source_changes.map(|it| it.source_file_edits).flatten());
468-
let workspace_edit = to_proto::workspace_edit(&snap, source_change)?;
469-
Ok(Some(workspace_edit))
468+
if source_change.source_file_edits.is_empty() {
469+
Ok(None)
470+
} else {
471+
to_proto::workspace_edit(&snap, source_change).map(Some)
472+
}
470473
}
471474

472475
pub(crate) fn handle_goto_definition(

0 commit comments

Comments
 (0)