@@ -102,7 +102,6 @@ import {
102102} from "./commandRunner" ;
103103import { CodeQlStatusBarHandler } from "./status-bar" ;
104104
105- import { Credentials } from "./authentication" ;
106105import { RemoteQueriesManager } from "./remote-queries/remote-queries-manager" ;
107106import { RemoteQueryResult } from "./remote-queries/remote-query-result" ;
108107import { URLSearchParams } from "url" ;
@@ -546,6 +545,8 @@ async function activateWithInstalledDistribution(
546545 // of activation.
547546 errorStubs . forEach ( ( stub ) => stub . dispose ( ) ) ;
548547
548+ const app = new ExtensionApp ( ctx ) ;
549+
549550 void extLogger . log ( "Initializing configuration listener..." ) ;
550551 const qlConfigurationListener =
551552 await QueryServerConfigListener . createQueryServerConfigListener (
@@ -555,6 +556,7 @@ async function activateWithInstalledDistribution(
555556
556557 void extLogger . log ( "Initializing CodeQL cli server..." ) ;
557558 const cliServer = new CodeQLCliServer (
559+ app ,
558560 distributionManager ,
559561 new CliConfigListener ( ) ,
560562 extLogger ,
@@ -587,11 +589,11 @@ async function activateWithInstalledDistribution(
587589 ctx . subscriptions . push ( dbm ) ;
588590 void extLogger . log ( "Initializing database panel." ) ;
589591 const databaseUI = new DatabaseUI (
592+ app ,
590593 dbm ,
591594 qs ,
592595 getContextStoragePath ( ctx ) ,
593596 ctx . extensionPath ,
594- ( ) => Credentials . initialize ( ) ,
595597 ) ;
596598 databaseUI . init ( ) ;
597599 ctx . subscriptions . push ( databaseUI ) ;
@@ -623,8 +625,6 @@ async function activateWithInstalledDistribution(
623625
624626 void extLogger . log ( "Initializing variant analysis manager." ) ;
625627
626- const app = new ExtensionApp ( ctx ) ;
627-
628628 const dbModule = await DbModule . initialize ( app ) ;
629629
630630 const variantAnalysisStorageDir = join (
@@ -633,12 +633,14 @@ async function activateWithInstalledDistribution(
633633 ) ;
634634 await ensureDir ( variantAnalysisStorageDir ) ;
635635 const variantAnalysisResultsManager = new VariantAnalysisResultsManager (
636+ app . credentials ,
636637 cliServer ,
637638 extLogger ,
638639 ) ;
639640
640641 const variantAnalysisManager = new VariantAnalysisManager (
641642 ctx ,
643+ app ,
642644 cliServer ,
643645 variantAnalysisStorageDir ,
644646 variantAnalysisResultsManager ,
@@ -656,6 +658,7 @@ async function activateWithInstalledDistribution(
656658 void extLogger . log ( "Initializing remote queries manager." ) ;
657659 const rqm = new RemoteQueriesManager (
658660 ctx ,
661+ app ,
659662 cliServer ,
660663 queryStorageDir ,
661664 extLogger ,
@@ -664,6 +667,7 @@ async function activateWithInstalledDistribution(
664667
665668 void extLogger . log ( "Initializing query history." ) ;
666669 const qhm = new QueryHistoryManager (
670+ app ,
667671 qs ,
668672 dbm ,
669673 localQueryResultsView ,
@@ -1245,7 +1249,7 @@ async function activateWithInstalledDistribution(
12451249 commandRunner (
12461250 "codeQL.exportRemoteQueryResults" ,
12471251 async ( queryId : string ) => {
1248- await exportRemoteQueryResults ( qhm , rqm , queryId ) ;
1252+ await exportRemoteQueryResults ( qhm , rqm , queryId , app . credentials ) ;
12491253 } ,
12501254 ) ,
12511255 ) ;
@@ -1263,6 +1267,7 @@ async function activateWithInstalledDistribution(
12631267 variantAnalysisManager ,
12641268 variantAnalysisId ,
12651269 filterSort ,
1270+ app . credentials ,
12661271 progress ,
12671272 token ,
12681273 ) ;
@@ -1363,9 +1368,7 @@ async function activateWithInstalledDistribution(
13631368 commandRunnerWithProgress (
13641369 "codeQL.chooseDatabaseGithub" ,
13651370 async ( progress : ProgressCallback , token : CancellationToken ) => {
1366- const credentials = isCanary ( )
1367- ? await Credentials . initialize ( )
1368- : undefined ;
1371+ const credentials = isCanary ( ) ? app . credentials : undefined ;
13691372 await databaseUI . handleChooseDatabaseGithub (
13701373 credentials ,
13711374 progress ,
@@ -1419,8 +1422,7 @@ async function activateWithInstalledDistribution(
14191422 * Credentials for authenticating to GitHub.
14201423 * These are used when making API calls.
14211424 */
1422- const credentials = await Credentials . initialize ( ) ;
1423- const octokit = await credentials . getOctokit ( ) ;
1425+ const octokit = await app . credentials . getOctokit ( ) ;
14241426 const userInfo = await octokit . users . getAuthenticated ( ) ;
14251427 void showAndLogInformationMessage (
14261428 `Authenticated to GitHub as user: ${ userInfo . data . login } ` ,
0 commit comments