From 37a3496bb050538c67940d9c846334ecba1e032b Mon Sep 17 00:00:00 2001 From: rebornix Date: Thu, 28 May 2020 10:28:54 -0700 Subject: [PATCH] share undo stack between text models in a notebook. the undo stack is not shared with notebook itself yet due to #98750. --- .../vscode-notebook-tests/src/notebook.test.ts | 2 +- .../notebook/browser/notebook.contribution.ts | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/extensions/vscode-notebook-tests/src/notebook.test.ts b/extensions/vscode-notebook-tests/src/notebook.test.ts index 897148a0c47..bd3a32e8204 100644 --- a/extensions/vscode-notebook-tests/src/notebook.test.ts +++ b/extensions/vscode-notebook-tests/src/notebook.test.ts @@ -480,7 +480,7 @@ suite('notebook dirty state', () => { }); suite('notebook undo redo', () => { - test.skip('notebook open', async function () { + test('notebook open', async function () { const resource = vscode.Uri.parse(join(vscode.workspace.rootPath || '', './first.vsctestnb')); await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest'); assert.equal(vscode.notebook.activeNotebookEditor !== undefined, true, 'notebook first'); diff --git a/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts b/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts index ab42dd7f597..b51074310b4 100644 --- a/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts +++ b/src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts @@ -126,15 +126,23 @@ export class NotebookContribution extends Disposable implements IWorkbenchContri this._register(undoRedoService.registerUriComparisonKeyComputer({ getComparisonKey: (uri: URI): string | null => { - // !!! Leave a fast check statement here !!! if (uri.scheme !== CellUri.scheme) { return null; } + const data = CellUri.parse(uri); if (!data) { return null; } - return data.notebook.toString(); + + return data.notebook.scheme + ':' + data.notebook.fsPath; + + // const documentUri = this._resourceMapping.get(data.notebook)?.resource; + // if (documentUri) { + // return documentUri.toString(); + // } + + // return null; } }));