@@ -383,6 +383,28 @@ public static async Task<List<Result>> QueryForPluginAsync(PluginPair pair, Quer
383
383
var results = new List < Result > ( ) ;
384
384
var metadata = pair . Metadata ;
385
385
386
+ if ( IsPluginInitializing ( metadata ) )
387
+ {
388
+ Result r = new ( )
389
+ {
390
+ Title = Localize . pluginStillInitializing ( metadata . Name ) ,
391
+ SubTitle = Localize . pluginStillInitializingSubtitle ( ) ,
392
+ IcoPath = metadata . IcoPath ,
393
+ PluginDirectory = metadata . PluginDirectory ,
394
+ ActionKeywordAssigned = query . ActionKeyword ,
395
+ PluginID = metadata . ID ,
396
+ OriginQuery = query ,
397
+ Action = _ =>
398
+ {
399
+ PublicApi . Instance . ReQuery ( ) ;
400
+ return false ;
401
+ } ,
402
+ Score = - 100
403
+ } ;
404
+ results . Add ( r ) ;
405
+ return results ;
406
+ }
407
+
386
408
try
387
409
{
388
410
var milliseconds = await PublicApi . Instance . StopwatchLogDebugAsync ( ClassName , $ "Cost for { metadata . Name } ",
@@ -427,6 +449,28 @@ public static async Task<List<Result>> QueryHomeForPluginAsync(PluginPair pair,
427
449
var results = new List < Result > ( ) ;
428
450
var metadata = pair . Metadata ;
429
451
452
+ if ( IsPluginInitializing ( metadata ) )
453
+ {
454
+ Result r = new ( )
455
+ {
456
+ Title = Localize . pluginStillInitializing ( metadata . Name ) ,
457
+ SubTitle = Localize . pluginStillInitializingSubtitle ( ) ,
458
+ IcoPath = metadata . IcoPath ,
459
+ PluginDirectory = metadata . PluginDirectory ,
460
+ ActionKeywordAssigned = query . ActionKeyword ,
461
+ PluginID = metadata . ID ,
462
+ OriginQuery = query ,
463
+ Action = _ =>
464
+ {
465
+ PublicApi . Instance . ReQuery ( ) ;
466
+ return false ;
467
+ } ,
468
+ Score = - 100
469
+ } ;
470
+ results . Add ( r ) ;
471
+ return results ;
472
+ }
473
+
430
474
try
431
475
{
432
476
var milliseconds = await PublicApi . Instance . StopwatchLogDebugAsync ( ClassName , $ "Cost for { metadata . Name } ",
@@ -457,6 +501,12 @@ public static async Task<List<DialogJumpResult>> QueryDialogJumpForPluginAsync(P
457
501
var results = new List < DialogJumpResult > ( ) ;
458
502
var metadata = pair . Metadata ;
459
503
504
+ if ( IsPluginInitializing ( metadata ) )
505
+ {
506
+ // null will be fine since the results will only be added into queue if the token hasn't been cancelled
507
+ return null ;
508
+ }
509
+
460
510
try
461
511
{
462
512
var milliseconds = await PublicApi . Instance . StopwatchLogDebugAsync ( ClassName , $ "Cost for { metadata . Name } ",
@@ -482,6 +532,11 @@ public static async Task<List<DialogJumpResult>> QueryDialogJumpForPluginAsync(P
482
532
return results ;
483
533
}
484
534
535
+ private static bool IsPluginInitializing ( PluginMetadata metadata )
536
+ {
537
+ return ! _allInitializedPlugins . ContainsKey ( metadata . ID ) ;
538
+ }
539
+
485
540
#endregion
486
541
487
542
#region Get Plugin List
0 commit comments