fix compile errors

This commit is contained in:
Johannes Rieken
2020-06-09 16:09:34 +02:00
parent c11155d0fc
commit e6135d58b8

View File

@@ -309,16 +309,16 @@ suite('notebook workflow', () => {
const resource = vscode.Uri.file(join(vscode.workspace.rootPath || '', './first.vsctestnb'));
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
assert.equal(vscode.notebook.activeNotebookEditor !== undefined, true, 'notebook first');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.source, 'test');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.document.getText(), 'test');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.language, 'typescript');
await vscode.commands.executeCommand('notebook.cell.insertCodeCellBelow');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.source, '');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.document.getText(), '');
await vscode.commands.executeCommand('notebook.cell.insertCodeCellAbove');
const activeCell = vscode.notebook.activeNotebookEditor!.selection;
assert.notEqual(vscode.notebook.activeNotebookEditor!.selection, undefined);
assert.equal(activeCell!.source, '');
assert.equal(activeCell!.document.getText(), '');
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.length, 3);
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.indexOf(activeCell!), 1);
@@ -330,18 +330,18 @@ suite('notebook workflow', () => {
const resource = vscode.Uri.file(join(vscode.workspace.rootPath || '', './first.vsctestnb'));
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
assert.equal(vscode.notebook.activeNotebookEditor !== undefined, true, 'notebook first');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.source, 'test');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.document.getText(), 'test');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.language, 'typescript');
// ---- insert cell below and focus ---- //
await vscode.commands.executeCommand('notebook.cell.insertCodeCellBelow');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.source, '');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.document.getText(), '');
// ---- insert cell above and focus ---- //
await vscode.commands.executeCommand('notebook.cell.insertCodeCellAbove');
let activeCell = vscode.notebook.activeNotebookEditor!.selection;
assert.notEqual(vscode.notebook.activeNotebookEditor!.selection, undefined);
assert.equal(activeCell!.source, '');
assert.equal(activeCell!.document.getText(), '');
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.length, 3);
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.indexOf(activeCell!), 1);
@@ -358,21 +358,21 @@ suite('notebook workflow', () => {
await vscode.commands.executeCommand('notebook.cell.copyDown');
activeCell = vscode.notebook.activeNotebookEditor!.selection;
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.indexOf(activeCell!), 1);
assert.equal(activeCell?.source, 'test');
assert.equal(activeCell?.document.getText(), 'test');
await vscode.commands.executeCommand('notebook.cell.delete');
activeCell = vscode.notebook.activeNotebookEditor!.selection;
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.indexOf(activeCell!), 1);
assert.equal(activeCell?.source, '');
assert.equal(activeCell?.document.getText(), '');
// ---- focus top and then copy up ---- //
await vscode.commands.executeCommand('notebook.focusTop');
await vscode.commands.executeCommand('notebook.cell.copyUp');
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.length, 4);
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells[0].source, 'test');
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells[1].source, 'test');
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells[2].source, '');
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells[3].source, '');
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells[0].document.getText(), 'test');
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells[1].document.getText(), 'test');
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells[2].document.getText(), '');
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells[3].document.getText(), '');
activeCell = vscode.notebook.activeNotebookEditor!.selection;
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.indexOf(activeCell!), 0);
@@ -381,17 +381,17 @@ suite('notebook workflow', () => {
await vscode.commands.executeCommand('notebook.cell.moveDown');
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.indexOf(vscode.notebook.activeNotebookEditor!.selection!), 1,
`first move down, active cell ${vscode.notebook.activeNotebookEditor!.selection!.uri.toString()}, ${vscode.notebook.activeNotebookEditor!.selection!.source}`);
`first move down, active cell ${vscode.notebook.activeNotebookEditor!.selection!.uri.toString()}, ${vscode.notebook.activeNotebookEditor!.selection!.document.getText()}`);
// await vscode.commands.executeCommand('notebook.cell.moveDown');
// activeCell = vscode.notebook.activeNotebookEditor!.selection;
// assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.indexOf(activeCell!), 2,
// `second move down, active cell ${vscode.notebook.activeNotebookEditor!.selection!.uri.toString()}, ${vscode.notebook.activeNotebookEditor!.selection!.source}`);
// assert.equal(vscode.notebook.activeNotebookEditor!.document.cells[0].source, 'test');
// assert.equal(vscode.notebook.activeNotebookEditor!.document.cells[1].source, '');
// assert.equal(vscode.notebook.activeNotebookEditor!.document.cells[2].source, 'test');
// assert.equal(vscode.notebook.activeNotebookEditor!.document.cells[3].source, '');
// `second move down, active cell ${vscode.notebook.activeNotebookEditor!.selection!.uri.toString()}, ${vscode.notebook.activeNotebookEditor!.selection!.document.getText()}`);
// assert.equal(vscode.notebook.activeNotebookEditor!.document.cells[0].document.getText(), 'test');
// assert.equal(vscode.notebook.activeNotebookEditor!.document.cells[1].document.getText(), '');
// assert.equal(vscode.notebook.activeNotebookEditor!.document.cells[2].document.getText(), 'test');
// assert.equal(vscode.notebook.activeNotebookEditor!.document.cells[3].document.getText(), '');
// ---- ---- //
@@ -491,16 +491,16 @@ suite('notebook dirty state', () => {
const resource = vscode.Uri.file(join(vscode.workspace.rootPath || '', './first.vsctestnb'));
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
assert.equal(vscode.notebook.activeNotebookEditor !== undefined, true, 'notebook first');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.source, 'test');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.document.getText(), 'test');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.language, 'typescript');
await vscode.commands.executeCommand('notebook.cell.insertCodeCellBelow');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.source, '');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.document.getText(), '');
await vscode.commands.executeCommand('notebook.cell.insertCodeCellAbove');
const activeCell = vscode.notebook.activeNotebookEditor!.selection;
assert.notEqual(vscode.notebook.activeNotebookEditor!.selection, undefined);
assert.equal(activeCell!.source, '');
assert.equal(activeCell!.document.getText(), '');
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.length, 3);
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.indexOf(activeCell!), 1);
@@ -513,7 +513,7 @@ suite('notebook dirty state', () => {
assert.equal(vscode.notebook.activeNotebookEditor !== undefined, true);
assert.equal(vscode.notebook.activeNotebookEditor?.selection !== undefined, true);
assert.deepEqual(vscode.notebook.activeNotebookEditor?.document.cells[1], vscode.notebook.activeNotebookEditor?.selection);
assert.equal(vscode.notebook.activeNotebookEditor?.selection?.source, 'var abc = 0;');
assert.equal(vscode.notebook.activeNotebookEditor?.selection?.document.getText(), 'var abc = 0;');
await vscode.commands.executeCommand('workbench.action.files.save');
await vscode.commands.executeCommand('workbench.action.closeActiveEditor');
@@ -525,16 +525,16 @@ suite('notebook undo redo', () => {
const resource = vscode.Uri.file(join(vscode.workspace.rootPath || '', './first.vsctestnb'));
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
assert.equal(vscode.notebook.activeNotebookEditor !== undefined, true, 'notebook first');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.source, 'test');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.document.getText(), 'test');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.language, 'typescript');
await vscode.commands.executeCommand('notebook.cell.insertCodeCellBelow');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.source, '');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.document.getText(), '');
await vscode.commands.executeCommand('notebook.cell.insertCodeCellAbove');
const activeCell = vscode.notebook.activeNotebookEditor!.selection;
assert.notEqual(vscode.notebook.activeNotebookEditor!.selection, undefined);
assert.equal(activeCell!.source, '');
assert.equal(activeCell!.document.getText(), '');
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.length, 3);
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.indexOf(activeCell!), 1);
@@ -550,13 +550,13 @@ suite('notebook undo redo', () => {
await vscode.commands.executeCommand('notebook.undo');
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.length, 3);
assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.indexOf(vscode.notebook.activeNotebookEditor!.selection!), 1);
assert.equal(vscode.notebook.activeNotebookEditor?.selection?.source, 'var abc = 0;');
assert.equal(vscode.notebook.activeNotebookEditor?.selection?.document.getText(), 'var abc = 0;');
// redo
// await vscode.commands.executeCommand('notebook.redo');
// assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.length, 2);
// assert.equal(vscode.notebook.activeNotebookEditor!.document.cells.indexOf(vscode.notebook.activeNotebookEditor!.selection!), 1);
// assert.equal(vscode.notebook.activeNotebookEditor?.selection?.source, 'test');
// assert.equal(vscode.notebook.activeNotebookEditor?.selection?.document.getText(), 'test');
await vscode.commands.executeCommand('workbench.action.files.save');
await vscode.commands.executeCommand('workbench.action.closeActiveEditor');
@@ -568,7 +568,7 @@ suite('notebook working copy', () => {
const resource = vscode.Uri.file(join(vscode.workspace.rootPath || '', './first.vsctestnb'));
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
await vscode.commands.executeCommand('notebook.cell.insertCodeCellBelow');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.source, '');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.document.getText(), '');
await vscode.commands.executeCommand('notebook.cell.insertCodeCellAbove');
await vscode.commands.executeCommand('default:type', { text: 'var abc = 0;' });
@@ -579,7 +579,7 @@ suite('notebook working copy', () => {
assert.equal(vscode.notebook.activeNotebookEditor !== undefined, true);
assert.equal(vscode.notebook.activeNotebookEditor?.selection !== undefined, true);
assert.deepEqual(vscode.notebook.activeNotebookEditor?.document.cells[0], vscode.notebook.activeNotebookEditor?.selection);
assert.equal(vscode.notebook.activeNotebookEditor?.selection?.source, 'test');
assert.equal(vscode.notebook.activeNotebookEditor?.selection?.document.getText(), 'test');
await vscode.commands.executeCommand('workbench.action.files.save');
await vscode.commands.executeCommand('workbench.action.closeActiveEditor');
@@ -589,7 +589,7 @@ suite('notebook working copy', () => {
const resource = vscode.Uri.file(join(vscode.workspace.rootPath || '', './first.vsctestnb'));
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
await vscode.commands.executeCommand('notebook.cell.insertCodeCellBelow');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.source, '');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.document.getText(), '');
await vscode.commands.executeCommand('notebook.cell.insertCodeCellAbove');
await vscode.commands.executeCommand('default:type', { text: 'var abc = 0;' });
@@ -599,7 +599,7 @@ suite('notebook working copy', () => {
assert.equal(vscode.notebook.activeNotebookEditor?.selection !== undefined, true);
assert.deepEqual(vscode.notebook.activeNotebookEditor?.document.cells[0], vscode.notebook.activeNotebookEditor?.selection);
assert.deepEqual(vscode.notebook.activeNotebookEditor?.document.cells.length, 1);
assert.equal(vscode.notebook.activeNotebookEditor?.selection?.source, 'test');
assert.equal(vscode.notebook.activeNotebookEditor?.selection?.document.getText(), 'test');
await vscode.commands.executeCommand('workbench.action.files.saveAll');
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
@@ -609,7 +609,7 @@ suite('notebook working copy', () => {
const resource = vscode.Uri.file(join(vscode.workspace.rootPath || '', './first.vsctestnb'));
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
await vscode.commands.executeCommand('notebook.cell.insertCodeCellBelow');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.source, '');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.document.getText(), '');
await vscode.commands.executeCommand('notebook.cell.insertCodeCellAbove');
await vscode.commands.executeCommand('default:type', { text: 'var abc = 0;' });
@@ -623,7 +623,7 @@ suite('notebook working copy', () => {
assert.equal(vscode.notebook.activeNotebookEditor?.selection !== undefined, true);
assert.deepEqual(vscode.notebook.activeNotebookEditor?.document.cells[1], vscode.notebook.activeNotebookEditor?.selection);
assert.deepEqual(vscode.notebook.activeNotebookEditor?.document.cells.length, 3);
assert.equal(vscode.notebook.activeNotebookEditor?.selection?.source, 'var abc = 0;');
assert.equal(vscode.notebook.activeNotebookEditor?.selection?.document.getText(), 'var abc = 0;');
await vscode.commands.executeCommand('workbench.action.files.save');
await vscode.commands.executeCommand('workbench.action.closeActiveEditor');
@@ -633,7 +633,7 @@ suite('notebook working copy', () => {
const resource = vscode.Uri.file(join(vscode.workspace.rootPath || '', './first.vsctestnb'));
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
await vscode.commands.executeCommand('notebook.cell.insertCodeCellBelow');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.source, '');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.document.getText(), '');
await vscode.commands.executeCommand('notebook.cell.insertCodeCellAbove');
await vscode.commands.executeCommand('default:type', { text: 'var abc = 0;' });
@@ -641,7 +641,7 @@ suite('notebook working copy', () => {
const secondResource = vscode.Uri.file(join(vscode.workspace.rootPath || '', './second.vsctestnb'));
await vscode.commands.executeCommand('vscode.openWith', secondResource, 'notebookCoreTest');
await vscode.commands.executeCommand('notebook.cell.insertCodeCellBelow');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.source, '');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.document.getText(), '');
// switch to the first editor
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
@@ -649,7 +649,7 @@ suite('notebook working copy', () => {
assert.equal(vscode.notebook.activeNotebookEditor?.selection !== undefined, true);
assert.deepEqual(vscode.notebook.activeNotebookEditor?.document.cells[1], vscode.notebook.activeNotebookEditor?.selection);
assert.deepEqual(vscode.notebook.activeNotebookEditor?.document.cells.length, 3);
assert.equal(vscode.notebook.activeNotebookEditor?.selection?.source, 'var abc = 0;');
assert.equal(vscode.notebook.activeNotebookEditor?.selection?.document.getText(), 'var abc = 0;');
// switch to the second editor
await vscode.commands.executeCommand('vscode.openWith', secondResource, 'notebookCoreTest');
@@ -657,7 +657,7 @@ suite('notebook working copy', () => {
assert.equal(vscode.notebook.activeNotebookEditor?.selection !== undefined, true);
assert.deepEqual(vscode.notebook.activeNotebookEditor?.document.cells[1], vscode.notebook.activeNotebookEditor?.selection);
assert.deepEqual(vscode.notebook.activeNotebookEditor?.document.cells.length, 2);
assert.equal(vscode.notebook.activeNotebookEditor?.selection?.source, '');
assert.equal(vscode.notebook.activeNotebookEditor?.selection?.document.getText(), '');
await vscode.commands.executeCommand('workbench.action.files.saveAll');
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
@@ -669,13 +669,13 @@ suite('notebook working copy', () => {
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
const firstNotebookEditor = vscode.notebook.activeNotebookEditor;
assert.equal(firstNotebookEditor !== undefined, true, 'notebook first');
assert.equal(firstNotebookEditor!.selection?.source, 'test');
assert.equal(firstNotebookEditor!.selection?.document.getText(), 'test');
assert.equal(firstNotebookEditor!.selection?.language, 'typescript');
await splitEditor();
const secondNotebookEditor = vscode.notebook.activeNotebookEditor;
assert.equal(secondNotebookEditor !== undefined, true, 'notebook first');
assert.equal(secondNotebookEditor!.selection?.source, 'test');
assert.equal(secondNotebookEditor!.selection?.document.getText(), 'test');
assert.equal(secondNotebookEditor!.selection?.language, 'typescript');
assert.notEqual(firstNotebookEditor, secondNotebookEditor);
@@ -719,7 +719,7 @@ suite('regression', () => {
const resource = vscode.Uri.file(join(vscode.workspace.rootPath || '', './empty.vsctestnb'));
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
assert.equal(vscode.notebook.activeNotebookEditor !== undefined, true, 'notebook first');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.source, '');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.document.getText(), '');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.language, 'typescript');
await vscode.commands.executeCommand('workbench.action.files.saveAll');
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
@@ -732,7 +732,7 @@ suite('regression', () => {
await vscode.commands.executeCommand('default:type', { text: 'var abc = 0;' });
assert.equal(vscode.notebook.activeNotebookEditor !== undefined, true, 'notebook first');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.source, 'var abc = 0;');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.document.getText(), 'var abc = 0;');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.language, 'typescript');
await vscode.commands.executeCommand('vscode.openWith', resource, 'default');