src/vs/workbench/api/common/extHostNotebookEditor.ts/ExtHostNotebookEditor/_applyEdit
class ExtHostNotebookEditor:	private _applyEdit(editData: INotebookEditData): Promise<boolean> {

		// return when there is nothing to do
		if (editData.cellEdits.length === 0) {
			return Promise.resolve(true);
		}

		const compressedEdits: ICellEditOperationDto[] = [];
		let compressedEditsIndex = -1;

		for (let i = 0; i < editData.cellEdits.length; i++) {
			if (compressedEditsIndex < 0) {
				compressedEdits.push(editData.cellEdits[i]);
				compressedEditsIndex++;
				continue;
			}

			const prevIndex = compressedEditsIndex;
			const prev = compressedEdits[prevIndex];

			const edit = editData.cellEdits[i];
			if (prev.editType === CellEditType.Replace && edit.editType === CellEditType.Replace) {
				if (prev.index === edit.index) {
					prev.cells.push(...(editData.cellEdits[i] as any).cells);
					prev.count += (editData.cellEdits[i] as any).count;
					continue;
				}
			}

			compressedEdits.push(editData.cellEdits[i]);
			compressedEditsIndex++;
		}

		return this._proxy.$tryApplyEdits(this.id, editData.documentVersionId, compressedEdits);
	}