Skip to content

Commit 0182a4b

Browse files
authored
Kernel picker type: all/mru. (microsoft#166523)
1 parent 126fd69 commit 0182a4b

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

src/vs/workbench/contrib/notebook/browser/notebook.contribution.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -910,11 +910,16 @@ configurationRegistry.registerConfiguration({
910910
type: 'string',
911911
tags: ['notebookLayout']
912912
},
913-
[NotebookSetting.kernelPickerMRU]: {
914-
markdownDescription: nls.localize('notebook.kernelPickerMRU', "Controls whether the kernel picker should show the most recently used kernels."),
915-
type: 'boolean',
913+
[NotebookSetting.kernelPickerType]: {
914+
markdownDescription: nls.localize('notebook.kernelPickerType', "Controls the type of kernel picker to use."),
915+
type: 'string',
916+
enum: ['all', 'mru'],
917+
enumDescriptions: [
918+
nls.localize('notebook.kernelPickerType.all', "Show all kernels."),
919+
nls.localize('notebook.kernelPickerType.mru', "Experiment: show recently used kernels."),
920+
],
916921
tags: ['notebookLayout'],
917-
default: false
922+
default: 'all'
918923
}
919924
}
920925
});

src/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelView.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ registerAction2(class extends Action2 {
8080
const instantiationService = accessor.get(IInstantiationService);
8181
const configurationService = accessor.get(IConfigurationService);
8282

83-
const usingMru = configurationService.getValue<boolean>('notebook.experimental.kernelPicker.mru');
83+
const kernelPickerType = configurationService.getValue<'all' | 'mru'>('notebook.kernelPicker.type');
8484

85-
if (usingMru) {
85+
if (kernelPickerType === 'mru') {
8686
const strategy = instantiationService.createInstance(KernelPickerMRUStrategy);
8787
return await strategy.showQuickPick(context);
8888
} else {
@@ -139,8 +139,8 @@ export class NotebooKernelActionViewItem extends ActionViewItem {
139139
return;
140140
}
141141

142-
const usingMru = this._configurationService.getValue<boolean>('notebook.experimental.kernelPicker.mru');
143-
if (usingMru) {
142+
const kernelPickerType = this._configurationService.getValue<'all' | 'mru'>('notebook.kernelPicker.type');
143+
if (kernelPickerType === 'mru') {
144144
KernelPickerMRUStrategy.updateKernelStatusAction(notebook, this._action, this._notebookKernelService);
145145
} else {
146146
KernelPickerFlatStrategy.updateKernelStatusAction(notebook, this._action, this._notebookKernelService, this._editor.scopedContextKeyService);

src/vs/workbench/contrib/notebook/common/notebookCommon.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ export const NotebookSetting = {
926926
outputLineHeight: 'notebook.outputLineHeight',
927927
outputFontSize: 'notebook.outputFontSize',
928928
outputFontFamily: 'notebook.outputFontFamily',
929-
kernelPickerMRU: 'notebook.experimental.kernelPicker.mru'
929+
kernelPickerType: 'notebook.kernelPicker.type'
930930
} as const;
931931

932932
export const enum CellStatusbarAlignment {

0 commit comments

Comments
 (0)