Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function isSourcePick(item: QuickPickInput<IQuickPickItem>): item is SourcePick
return 'action' in item;
}
type KernelQuickPickItem = IQuickPickItem | KernelPick | SourcePick;
const KERNEL_PICKER_UPDATE_DEBOUNCE = 200;

registerAction2(class extends Action2 {
constructor() {
Expand Down Expand Up @@ -187,11 +188,15 @@ registerAction2(class extends Action2 {
? nls.localize('prompt.placeholder.change', "Change kernel for '{0}'", labelService.getUriLabel(notebook.uri, { relative: true }))
: nls.localize('prompt.placeholder.select', "Select kernel for '{0}'", labelService.getUriLabel(notebook.uri, { relative: true }));

const kernelChangeEventListener = Event.any(
notebookKernelService.onDidChangeSourceActions,
notebookKernelService.onDidAddKernel,
notebookKernelService.onDidRemoveKernel,
notebookKernelService.onDidChangeNotebookAffinity
const kernelChangeEventListener = Event.debounce<void, void>(
Event.any(
notebookKernelService.onDidChangeSourceActions,
notebookKernelService.onDidAddKernel,
notebookKernelService.onDidRemoveKernel,
notebookKernelService.onDidChangeNotebookAffinity
),
(last, _current) => last,
KERNEL_PICKER_UPDATE_DEBOUNCE
)(() => {
const currentActiveItems = quickPick.activeItems;
const matchResult = notebookKernelService.getMatchingKernel(notebook);
Expand All @@ -218,7 +223,7 @@ registerAction2(class extends Action2 {

quickPick.items = quickPickItemSuggestions.quickPickItems;
quickPick.activeItems = activeItems;
});
}, this);

const pick = await new Promise<KernelQuickPickItem>((resolve, reject) => {
quickPick.onDidAccept(() => {
Expand Down