Don't return a SourceChange on WillRenameFiles when nothing gets refactored
This commit is contained in:
@@ -465,8 +465,11 @@ pub(crate) fn handle_will_rename_files(
|
|||||||
source_change.file_system_edits.clear();
|
source_change.file_system_edits.clear();
|
||||||
// no collect here because we want to merge text edits on same file ids
|
// no collect here because we want to merge text edits on same file ids
|
||||||
source_change.extend(source_changes.map(|it| it.source_file_edits).flatten());
|
source_change.extend(source_changes.map(|it| it.source_file_edits).flatten());
|
||||||
let workspace_edit = to_proto::workspace_edit(&snap, source_change)?;
|
if source_change.source_file_edits.is_empty() {
|
||||||
Ok(Some(workspace_edit))
|
Ok(None)
|
||||||
|
} else {
|
||||||
|
to_proto::workspace_edit(&snap, source_change).map(Some)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn handle_goto_definition(
|
pub(crate) fn handle_goto_definition(
|
||||||
|
|||||||
@@ -838,9 +838,7 @@ fn main() {}
|
|||||||
new_uri: base_path.join("src/from_mod/foo.rs").to_str().unwrap().to_string(),
|
new_uri: base_path.join("src/from_mod/foo.rs").to_str().unwrap().to_string(),
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
json!({
|
json!(null),
|
||||||
"documentChanges": []
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//rename file from foo.rs to mod.rs
|
//rename file from foo.rs to mod.rs
|
||||||
@@ -851,9 +849,7 @@ fn main() {}
|
|||||||
new_uri: base_path.join("src/to_mod/mod.rs").to_str().unwrap().to_string(),
|
new_uri: base_path.join("src/to_mod/mod.rs").to_str().unwrap().to_string(),
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
json!({
|
json!(null),
|
||||||
"documentChanges": []
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//rename same level file
|
//rename same level file
|
||||||
|
|||||||
Reference in New Issue
Block a user