#4586: Clear Results feature in Notebooks (#4705)

* #4586: Clear all outputs feature

* text change

* Adding extensible method with integration tests

* Misc change

* Misc change

* Adding more logging

* Change to test

* Adding outputs confition in integration tests
This commit is contained in:
Raj
2019-03-28 15:20:28 -07:00
committed by GitHub
parent 7eb17f6abc
commit 1415aa1c03
11 changed files with 108 additions and 3 deletions

View File

@@ -156,6 +156,10 @@ export class ExtHostNotebookEditor implements azdata.nb.NotebookEditor, IDisposa
return this._proxy.$runCell(this._id, uri);
}
public clearAllOutputs(): Thenable<boolean> {
return this._proxy.$clearAllOutputs(this._id);
}
public edit(callback: (editBuilder: azdata.nb.NotebookEditorEdit) => void, options?: { undoStopBefore: boolean; undoStopAfter: boolean; }): Thenable<boolean> {
if (this._disposed) {
return Promise.reject(new Error('NotebookEditor#edit not possible on closed editors'));

View File

@@ -125,6 +125,13 @@ class MainThreadNotebookEditor extends Disposable {
return this.editor.runCell(cell);
}
public clearAllOutputs(): Promise<boolean> {
if (!this.editor) {
return Promise.resolve(false);
}
return this.editor.clearAllOutputs();
}
}
function wait(timeMs: number): Promise<void> {
@@ -359,6 +366,14 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
return editor.runCell(cell);
}
$clearAllOutputs(id: string): Promise<boolean> {
let editor = this.getEditor(id);
if (!editor) {
return Promise.reject(disposed(`TextEditor(${id})`));
}
return editor.clearAllOutputs();
}
//#endregion
private async doOpenEditor(resource: UriComponents, options: INotebookShowOptions): Promise<string> {

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>;
$clearAllOutputs(id: string): Promise<boolean>;
}
export interface ExtHostExtensionManagementShape {