@@ -49,6 +49,7 @@ function isSourcePick(item: QuickPickInput<IQuickPickItem>): item is SourcePick
4949 return 'action' in item ;
5050}
5151type KernelQuickPickItem = IQuickPickItem | KernelPick | SourcePick ;
52+ const KERNEL_PICKER_UPDATE_DEBOUNCE = 200 ;
5253
5354registerAction2 ( class extends Action2 {
5455 constructor ( ) {
@@ -187,11 +188,15 @@ registerAction2(class extends Action2 {
187188 ? nls . localize ( 'prompt.placeholder.change' , "Change kernel for '{0}'" , labelService . getUriLabel ( notebook . uri , { relative : true } ) )
188189 : nls . localize ( 'prompt.placeholder.select' , "Select kernel for '{0}'" , labelService . getUriLabel ( notebook . uri , { relative : true } ) ) ;
189190
190- const kernelChangeEventListener = Event . any (
191- notebookKernelService . onDidChangeSourceActions ,
192- notebookKernelService . onDidAddKernel ,
193- notebookKernelService . onDidRemoveKernel ,
194- notebookKernelService . onDidChangeNotebookAffinity
191+ const kernelChangeEventListener = Event . debounce < void , void > (
192+ Event . any (
193+ notebookKernelService . onDidChangeSourceActions ,
194+ notebookKernelService . onDidAddKernel ,
195+ notebookKernelService . onDidRemoveKernel ,
196+ notebookKernelService . onDidChangeNotebookAffinity
197+ ) ,
198+ ( last , _current ) => last ,
199+ KERNEL_PICKER_UPDATE_DEBOUNCE
195200 ) ( ( ) => {
196201 const currentActiveItems = quickPick . activeItems ;
197202 const matchResult = notebookKernelService . getMatchingKernel ( notebook ) ;
@@ -218,7 +223,7 @@ registerAction2(class extends Action2 {
218223
219224 quickPick . items = quickPickItemSuggestions . quickPickItems ;
220225 quickPick . activeItems = activeItems ;
221- } ) ;
226+ } , this ) ;
222227
223228 const pick = await new Promise < KernelQuickPickItem > ( ( resolve , reject ) => {
224229 quickPick . onDidAccept ( ( ) => {
0 commit comments