@@ -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 ,
@@ -1224,7 +1228,7 @@ async function activateWithInstalledDistribution(
12241228 commandRunner (
12251229 "codeQL.exportRemoteQueryResults" ,
12261230 async ( queryId : string ) => {
1227- await exportRemoteQueryResults ( qhm , rqm , queryId ) ;
1231+ await exportRemoteQueryResults ( qhm , rqm , queryId , app . credentials ) ;
12281232 } ,
12291233 ) ,
12301234 ) ;
@@ -1242,6 +1246,7 @@ async function activateWithInstalledDistribution(
12421246 variantAnalysisManager ,
12431247 variantAnalysisId ,
12441248 filterSort ,
1249+ app . credentials ,
12451250 progress ,
12461251 token ,
12471252 ) ;
@@ -1342,9 +1347,7 @@ async function activateWithInstalledDistribution(
13421347 commandRunnerWithProgress (
13431348 "codeQL.chooseDatabaseGithub" ,
13441349 async ( progress : ProgressCallback , token : CancellationToken ) => {
1345- const credentials = isCanary ( )
1346- ? await Credentials . initialize ( )
1347- : undefined ;
1350+ const credentials = isCanary ( ) ? app . credentials : undefined ;
13481351 await databaseUI . handleChooseDatabaseGithub (
13491352 credentials ,
13501353 progress ,
@@ -1398,8 +1401,7 @@ async function activateWithInstalledDistribution(
13981401 * Credentials for authenticating to GitHub.
13991402 * These are used when making API calls.
14001403 */
1401- const credentials = await Credentials . initialize ( ) ;
1402- const octokit = await credentials . getOctokit ( ) ;
1404+ const octokit = await app . credentials . getOctokit ( ) ;
14031405 const userInfo = await octokit . users . getAuthenticated ( ) ;
14041406 void showAndLogInformationMessage (
14051407 `Authenticated to GitHub as user: ${ userInfo . data . login } ` ,
0 commit comments