@@ -49,6 +49,7 @@ function isSourcePick(item: QuickPickInput<IQuickPickItem>): item is SourcePick
49
49
return 'action' in item ;
50
50
}
51
51
type KernelQuickPickItem = IQuickPickItem | KernelPick | SourcePick ;
52
+ const KERNEL_PICKER_UPDATE_DEBOUNCE = 200 ;
52
53
53
54
registerAction2 ( class extends Action2 {
54
55
constructor ( ) {
@@ -187,11 +188,15 @@ registerAction2(class extends Action2 {
187
188
? nls . localize ( 'prompt.placeholder.change' , "Change kernel for '{0}'" , labelService . getUriLabel ( notebook . uri , { relative : true } ) )
188
189
: nls . localize ( 'prompt.placeholder.select' , "Select kernel for '{0}'" , labelService . getUriLabel ( notebook . uri , { relative : true } ) ) ;
189
190
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
195
200
) ( ( ) => {
196
201
const currentActiveItems = quickPick . activeItems ;
197
202
const matchResult = notebookKernelService . getMatchingKernel ( notebook ) ;
@@ -218,7 +223,7 @@ registerAction2(class extends Action2 {
218
223
219
224
quickPick . items = quickPickItemSuggestions . quickPickItems ;
220
225
quickPick . activeItems = activeItems ;
221
- } ) ;
226
+ } , this ) ;
222
227
223
228
const pick = await new Promise < KernelQuickPickItem > ( ( resolve , reject ) => {
224
229
quickPick . onDidAccept ( ( ) => {
0 commit comments