@@ -73,7 +73,8 @@ import { WebviewReveal } from './interface-utils';
7373import { ideServerLogger , logger , ProgressReporter , queryServerLogger } from './logging' ;
7474import { QueryHistoryManager } from './query-history' ;
7575import { CompletedLocalQueryInfo , LocalQueryInfo } from './query-results' ;
76- import * as qsClient from './legacy-query-server/queryserver-client' ;
76+ import * as legacyQueryServer from './legacy-query-server/queryserver-client' ;
77+ import * as newQueryServer from './query-server/queryserver-client' ;
7778import { displayQuickQuery } from './quick-query' ;
7879import { QLTestAdapterFactory } from './test-adapter' ;
7980import { TestUIService } from './test-ui' ;
@@ -103,6 +104,7 @@ import { JoinOrderScannerProvider } from './log-insights/join-order';
103104import { LogScannerService } from './log-insights/log-scanner-service' ;
104105import { createInitialQueryInfo } from './run-queries-shared' ;
105106import { LegacyQueryRunner } from './legacy-query-server/legacyRunner' ;
107+ import { NewQueryRunner } from './query-server/query-runner' ;
106108import { QueryRunner } from './queryRunner' ;
107109import { VariantAnalysisView } from './remote-queries/variant-analysis-view' ;
108110import { VariantAnalysisViewSerializer } from './remote-queries/variant-analysis-view-serializer' ;
@@ -406,6 +408,8 @@ export async function activate(ctx: ExtensionContext): Promise<CodeQLExtensionIn
406408 return codeQlExtension ;
407409}
408410
411+ const PACK_GLOBS = [ '**/codeql-pack.yml' , '**/qlpack.yml' , '**/queries.xml' , '**/codeql-pack.lock.yml' , '**/qlpack.lock.yml' , '.codeqlmanifest.json' , 'codeql-workspace.yml' ] ;
412+
409413async function activateWithInstalledDistribution (
410414 ctx : ExtensionContext ,
411415 distributionManager : DistributionManager ,
@@ -436,6 +440,15 @@ async function activateWithInstalledDistribution(
436440 void logger . log ( 'Initializing query server client.' ) ;
437441 const qs = await createQueryServer ( qlConfigurationListener , cliServer , ctx ) ;
438442
443+
444+ for ( const glob of PACK_GLOBS ) {
445+ const fsWatcher = workspace . createFileSystemWatcher ( glob ) ;
446+ ctx . subscriptions . push ( fsWatcher ) ;
447+ fsWatcher . onDidChange ( async ( _uri ) => {
448+ await qs . clearPackCache ( ) ;
449+ } ) ;
450+ }
451+
439452 void logger . log ( 'Initializing database manager.' ) ;
440453 const dbm = new DatabaseManager ( ctx , qs , cliServer , logger ) ;
441454 ctx . subscriptions . push ( dbm ) ;
@@ -1199,15 +1212,28 @@ async function createQueryServer(qlConfigurationListener: QueryServerConfigListe
11991212 { title : 'CodeQL query server' , location : ProgressLocation . Window } ,
12001213 task
12011214 ) ;
1202- const qs = new qsClient . QueryServerClient (
1203- qlConfigurationListener ,
1204- cliServer ,
1205- qsOpts ,
1206- progressCallback
1207- ) ;
1208- ctx . subscriptions . push ( qs ) ;
1209- await qs . startQueryServer ( ) ;
1210- return new LegacyQueryRunner ( qs ) ;
1215+ if ( await cliServer . cliConstraints . supportsNewQueryServer ( ) ) {
1216+ const qs = new newQueryServer . QueryServerClient (
1217+ qlConfigurationListener ,
1218+ cliServer ,
1219+ qsOpts ,
1220+ progressCallback
1221+ ) ;
1222+ ctx . subscriptions . push ( qs ) ;
1223+ await qs . startQueryServer ( ) ;
1224+ return new NewQueryRunner ( qs ) ;
1225+
1226+ } else {
1227+ const qs = new legacyQueryServer . QueryServerClient (
1228+ qlConfigurationListener ,
1229+ cliServer ,
1230+ qsOpts ,
1231+ progressCallback
1232+ ) ;
1233+ ctx . subscriptions . push ( qs ) ;
1234+ await qs . startQueryServer ( ) ;
1235+ return new LegacyQueryRunner ( qs ) ;
1236+ }
12111237}
12121238
12131239function getContextStoragePath ( ctx : ExtensionContext ) {
0 commit comments