mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-21 09:35:38 -05:00
Enable status bar for notebooks (#14817)
* enable status bar for notebooks * add onCellExecutionStart event to notebook service * fix test, change var name
This commit is contained in:
@@ -531,6 +531,7 @@ export class CellModel extends Disposable implements ICellModel {
|
||||
}, false);
|
||||
this.setFuture(future as FutureInternal);
|
||||
this.fireExecutionStateChanged();
|
||||
this._notebookService?.notifyCellExecutionStarted();
|
||||
// For now, await future completion. Later we should just track and handle cancellation based on model notifications
|
||||
let result: nb.IExecuteReplyMsg = <nb.IExecuteReplyMsg><any>await future.done;
|
||||
if (result && result.content) {
|
||||
@@ -551,6 +552,7 @@ export class CellModel extends Disposable implements ICellModel {
|
||||
let commandExecuted = this._commandService?.executeCommand(result.commandId, result.args);
|
||||
// This will ensure that the run button turns into a stop button
|
||||
this.fireExecutionStateChanged();
|
||||
this._notebookService?.notifyCellExecutionStarted();
|
||||
await commandExecuted;
|
||||
// For save files, if we output a message after saving the file, the file becomes dirty again.
|
||||
// Special casing this to avoid this particular issue.
|
||||
|
||||
@@ -129,6 +129,16 @@ export interface INotebookService {
|
||||
* @param isTrusted True if notebook is to be set to trusted, false otherwise.
|
||||
*/
|
||||
setTrusted(notebookUri: URI, isTrusted: boolean): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Event that gets fired when a cell is executed.
|
||||
*/
|
||||
onCodeCellExecutionStart: Event<void>;
|
||||
|
||||
/**
|
||||
* Fires the onCodeCellExecutionStart event.
|
||||
*/
|
||||
notifyCellExecutionStarted(): void;
|
||||
}
|
||||
|
||||
export interface INotebookProvider {
|
||||
|
||||
@@ -108,6 +108,7 @@ export class NotebookService extends Disposable implements INotebookService {
|
||||
private _isRegistrationComplete = false;
|
||||
private _trustedCacheQueue: URI[] = [];
|
||||
private _unTrustedCacheQueue: URI[] = [];
|
||||
private _onCodeCellExecutionStart: Emitter<void> = new Emitter<void>();
|
||||
|
||||
constructor(
|
||||
@ILifecycleService lifecycleService: ILifecycleService,
|
||||
@@ -639,4 +640,12 @@ export class NotebookService extends Disposable implements INotebookService {
|
||||
|
||||
return isTrusted;
|
||||
}
|
||||
|
||||
get onCodeCellExecutionStart(): Event<void> {
|
||||
return this._onCodeCellExecutionStart.event;
|
||||
}
|
||||
|
||||
notifyCellExecutionStarted(): void {
|
||||
this._onCodeCellExecutionStart.fire();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user