@@ -8,14 +8,27 @@ import { QueryDiscovery } from "./query-discovery";
88import { QueryPackDiscovery } from "./query-pack-discovery" ;
99
1010export class QueriesModule extends DisposableObject {
11+ private queriesPanel : QueriesPanel | undefined ;
12+
1113 private constructor ( readonly app : App ) {
1214 super ( ) ;
1315 }
1416
17+ public static initialize (
18+ app : App ,
19+ cliServer : CodeQLCliServer ,
20+ ) : QueriesModule {
21+ const queriesModule = new QueriesModule ( app ) ;
22+ app . subscriptions . push ( queriesModule ) ;
23+
24+ queriesModule . initialize ( app , cliServer ) ;
25+ return queriesModule ;
26+ }
27+
1528 private initialize ( app : App , cliServer : CodeQLCliServer ) : void {
29+ // Currently, we only want to expose the new panel when we are in canary mode
30+ // and the user has enabled the "Show queries panel" flag.
1631 if ( ! isCanary ( ) || ! showQueriesPanel ( ) ) {
17- // Currently, we only want to expose the new panel when we are in canary mode
18- // and the user has enabled the "Show queries panel" flag.
1932 return ;
2033 }
2134 void extLogger . log ( "Initializing queries panel." ) ;
@@ -31,18 +44,7 @@ export class QueriesModule extends DisposableObject {
3144 this . push ( queryDiscovery ) ;
3245 void queryDiscovery . initialRefresh ( ) ;
3346
34- const queriesPanel = new QueriesPanel ( queryDiscovery ) ;
35- this . push ( queriesPanel ) ;
36- }
37-
38- public static initialize (
39- app : App ,
40- cliServer : CodeQLCliServer ,
41- ) : QueriesModule {
42- const queriesModule = new QueriesModule ( app ) ;
43- app . subscriptions . push ( queriesModule ) ;
44-
45- queriesModule . initialize ( app , cliServer ) ;
46- return queriesModule ;
47+ this . queriesPanel = new QueriesPanel ( queryDiscovery ) ;
48+ this . push ( this . queriesPanel ) ;
4749 }
4850}
0 commit comments