mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Fix RunAllCells throwing unhandled exception (#6089)
- Added await here. - There's a 2nd entry point already doing it the right way, in the Notebook extension. No need to change that
This commit is contained in:
@@ -407,7 +407,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
|||||||
let addTextCellButton = new AddCellAction('notebook.AddTextCell', localize('text', "Text"), 'notebook-button icon-add');
|
let addTextCellButton = new AddCellAction('notebook.AddTextCell', localize('text', "Text"), 'notebook-button icon-add');
|
||||||
addTextCellButton.cellType = CellTypes.Markdown;
|
addTextCellButton.cellType = CellTypes.Markdown;
|
||||||
|
|
||||||
this._runAllCellsAction = new RunAllCellsAction('notebook.runAllCells', localize('runAll', "Run Cells"), 'notebook-button icon-run-cells');
|
this._runAllCellsAction = this.instantiationService.createInstance(RunAllCellsAction, 'notebook.runAllCells', localize('runAll', "Run Cells"), 'notebook-button icon-run-cells');
|
||||||
let clearResultsButton = new ClearAllOutputsAction('notebook.ClearAllOutputs', localize('clearResults', "Clear Results"), 'notebook-button icon-clear-results');
|
let clearResultsButton = new ClearAllOutputsAction('notebook.ClearAllOutputs', localize('clearResults', "Clear Results"), 'notebook-button icon-clear-results');
|
||||||
|
|
||||||
this._trustedAction = this.instantiationService.createInstance(TrustedAction, 'notebook.Trusted');
|
this._trustedAction = this.instantiationService.createInstance(TrustedAction, 'notebook.Trusted');
|
||||||
|
|||||||
@@ -252,19 +252,19 @@ export class TrustedAction extends ToggleableAction {
|
|||||||
// Action to run all code cells in a notebook.
|
// Action to run all code cells in a notebook.
|
||||||
export class RunAllCellsAction extends Action {
|
export class RunAllCellsAction extends Action {
|
||||||
constructor(
|
constructor(
|
||||||
id: string, label: string, cssClass: string
|
id: string, label: string, cssClass: string,
|
||||||
|
@INotificationService private notificationService: INotificationService
|
||||||
) {
|
) {
|
||||||
super(id, label, cssClass);
|
super(id, label, cssClass);
|
||||||
}
|
}
|
||||||
public run(context: NotebookComponent): Promise<boolean> {
|
public async run(context: NotebookComponent): Promise<boolean> {
|
||||||
return new Promise<boolean>((resolve, reject) => {
|
try {
|
||||||
try {
|
await context.runAllCells();
|
||||||
context.runAllCells();
|
return true;
|
||||||
resolve(true);
|
} catch (e) {
|
||||||
} catch (e) {
|
this.notificationService.error(getErrorMessage(e));
|
||||||
reject(e);
|
return false;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user