Add Notebook Save integration tests (#6103)

* Add Notebook Save integration tests
Wrote test to verify save behavior
Fixed issues found during testing,
specifically around how we notify dirty state change to extensions

* Improved error messages
This commit is contained in:
Kevin Cunnane
2019-06-19 16:09:24 -07:00
committed by GitHub
parent 32313c71e4
commit 47cf496c36
4 changed files with 58 additions and 11 deletions

View File

@@ -15,6 +15,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
import { Schemas } from 'vs/base/common/network';
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
import * as types from 'vs/base/common/types';
import {
SqlMainContext, MainThreadNotebookDocumentsAndEditorsShape, SqlExtHostContext, ExtHostNotebookDocumentsAndEditorsShape,
@@ -560,7 +561,7 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
let changeData: INotebookModelChangedData = {
// Note: we just send all cells for now, not a diff
cells: this.convertCellModelToNotebookCell(editor.cells),
isDirty: e.isDirty,
isDirty: this.getDirtyState(e, editor),
providerId: editor.providerId,
providers: editor.providers,
uri: editor.uri,
@@ -570,10 +571,16 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
return changeData;
}
private getDirtyState(e: NotebookContentChange, editor: MainThreadNotebookEditor): boolean {
if (!types.isUndefinedOrNull(e.isDirty)) {
return e.isDirty;
}
return editor.isDirty;
}
mapChangeKind(changeType: NotebookChangeType): NotebookChangeKind {
switch (changeType) {
case NotebookChangeType.CellDeleted:
case NotebookChangeType.CellsAdded:
case NotebookChangeType.CellsModified:
case NotebookChangeType.CellOutputUpdated:
case NotebookChangeType.CellSourceUpdated:
case NotebookChangeType.DirtyStateChanged: