Skip to content

Commit

Permalink
Pass autoStartDefault
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya211935 authored and fcollonval committed Feb 23, 2023
1 parent b2fa524 commit bb0df81
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/docregistry/src/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ export abstract class ABCWidgetFactory<
this._preferKernel = !!options.preferKernel;
this._canStartKernel = !!options.canStartKernel;
this._shutdownOnClose = !!options.shutdownOnClose;
this._autoStartDefault = !!options.autoStartDefault;
this._selectPreferredKernel = !!options.selectPreferredKernel;
this._toolbarFactory = options.toolbarFactory;
}
Expand Down Expand Up @@ -441,6 +442,14 @@ export abstract class ABCWidgetFactory<
return this._canStartKernel;
}

/**
* Automatically start the default kernel if no other matching kernel is
* found.
*/
get autoStartDefault(): boolean {
return this._autoStartDefault;
}

/**
* The application language translator.
*/
Expand Down Expand Up @@ -520,6 +529,7 @@ export abstract class ABCWidgetFactory<
private _shutdownOnClose: boolean;
private _selectPreferredKernel: boolean;
private _preferKernel: boolean;
private _autoStartDefault: boolean;
private _modelName: string;
private _fileTypes: string[];
private _defaultFor: string[];
Expand Down
7 changes: 7 additions & 0 deletions packages/docregistry/src/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ export class DocumentRegistry implements IDisposable {
shouldStart: widgetFactory.preferKernel,
canStart: widgetFactory.canStartKernel,
shutdownOnDispose: widgetFactory.shutdownOnClose,
autoStartDefault: widgetFactory.autoStartDefault,
selectPreferredKernel: widgetFactory.selectPreferredKernel
};
}
Expand Down Expand Up @@ -1038,6 +1039,12 @@ export namespace DocumentRegistry {
IRenderMime.IDocumentWidgetFactoryOptions,
'primaryFileType' | 'toolbarFactory'
> {
/**
* Automatically start the default kernel if no other matching kernel is
* found.
*/
readonly autoStartDefault?: boolean;

/**
* Whether the widget factory is read only.
*/
Expand Down
1 change: 1 addition & 0 deletions packages/notebook-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,7 @@ function activateWidgetFactory(
defaultFor: ['notebook'],
preferKernel: preferKernelValue,
canStartKernel: true,
autoStartDefault: true,
rendermime,
contentFactory,
editorConfig: StaticNotebook.defaultEditorConfig,
Expand Down

0 comments on commit bb0df81

Please sign in to comment.