Run All Cells Notebook Implementation (#4713)

* runAllCells API

* add comment

* more run cells fixes

* Add integration test

* Add multiple cell SQL notebook test

* Comment out python tests as they fail in the lab

* remove unused imports

* PR comments

* Remove localize

* Return true instead of promise.resolve(true)
This commit is contained in:
Chris LaFreniere
2019-04-02 16:47:00 -07:00
committed by GitHub
parent 219dfe66d0
commit 07166fb3cd
13 changed files with 165 additions and 11 deletions

View File

@@ -156,6 +156,10 @@ export class ExtHostNotebookEditor implements azdata.nb.NotebookEditor, IDisposa
return this._proxy.$runCell(this._id, uri);
}
public runAllCells(): Thenable<boolean> {
return this._proxy.$runAllCells(this._id);
}
public clearAllOutputs(): Thenable<boolean> {
return this._proxy.$clearAllOutputs(this._id);
}

View File

@@ -122,10 +122,16 @@ class MainThreadNotebookEditor extends Disposable {
if (!this.editor) {
return Promise.resolve(false);
}
return this.editor.runCell(cell);
}
public runAllCells(): Promise<boolean> {
if (!this.editor) {
return Promise.resolve(false);
}
return this.editor.runAllCells();
}
public clearAllOutputs(): Promise<boolean> {
if (!this.editor) {
return Promise.resolve(false);
@@ -366,6 +372,14 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
return editor.runCell(cell);
}
$runAllCells(id: string): Promise<boolean> {
let editor = this.getEditor(id);
if (!editor) {
return Promise.reject(disposed(`TextEditor(${id})`));
}
return editor.runAllCells();
}
$clearAllOutputs(id: string): Promise<boolean> {
let editor = this.getEditor(id);
if (!editor) {

View File

@@ -866,6 +866,7 @@ export interface MainThreadNotebookDocumentsAndEditorsShape extends IDisposable
$tryShowNotebookDocument(resource: UriComponents, options: INotebookShowOptions): Promise<string>;
$tryApplyEdits(id: string, modelVersionId: number, edits: ISingleNotebookEditOperation[], opts: IUndoStopOptions): Promise<boolean>;
$runCell(id: string, cellUri: UriComponents): Promise<boolean>;
$runAllCells(id: string): Promise<boolean>;
$clearAllOutputs(id: string): Promise<boolean>;
}