source_change.file_system_edits.clear();
// 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());
- let workspace_edit = to_proto::workspace_edit(&snap, source_change)?;
- Ok(Some(workspace_edit))
+ if source_change.source_file_edits.is_empty() {
+ Ok(None)
+ } else {
+ to_proto::workspace_edit(&snap, source_change).map(Some)
+ }
}
pub(crate) fn handle_goto_definition(
new_uri: base_path.join("src/from_mod/foo.rs").to_str().unwrap().to_string(),
}],
},
- json!({
- "documentChanges": []
- }),
+ json!(null),
);
//rename file from foo.rs to mod.rs
new_uri: base_path.join("src/to_mod/mod.rs").to_str().unwrap().to_string(),
}],
},
- json!({
- "documentChanges": []
- }),
+ json!(null),
);
//rename same level file