@@ -89,19 +89,10 @@ import { QLTestAdapterFactory } from "./test-adapter";
8989import { TestUIService } from "./test-ui" ;
9090import { CompareView } from "./compare/compare-view" ;
9191import { initializeTelemetry } from "./telemetry" ;
92- import {
93- commandRunner ,
94- commandRunnerWithProgress ,
95- ProgressCallback ,
96- withProgress ,
97- } from "./commandRunner" ;
92+ import { commandRunner , ProgressCallback , withProgress } from "./commandRunner" ;
9893import { CodeQlStatusBarHandler } from "./status-bar" ;
99- import {
100- handleDownloadPacks ,
101- handleInstallPackDependencies ,
102- } from "./packaging" ;
94+ import { getPackagingCommands } from "./packaging" ;
10395import { HistoryItemLabelProvider } from "./query-history/history-item-label-provider" ;
104- import { exportSelectedVariantAnalysisResults } from "./variant-analysis/export-results" ;
10596import { EvalLogViewer } from "./eval-log-viewer" ;
10697import { SummaryLanguageSupport } from "./log-insights/summary-language-support" ;
10798import { JoinOrderScannerProvider } from "./log-insights/join-order" ;
@@ -111,16 +102,11 @@ import { NewQueryRunner } from "./query-server/query-runner";
111102import { QueryRunner } from "./queryRunner" ;
112103import { VariantAnalysisView } from "./variant-analysis/variant-analysis-view" ;
113104import { VariantAnalysisViewSerializer } from "./variant-analysis/variant-analysis-view-serializer" ;
114- import {
115- VariantAnalysis ,
116- VariantAnalysisScannedRepository ,
117- } from "./variant-analysis/shared/variant-analysis" ;
118105import { VariantAnalysisManager } from "./variant-analysis/variant-analysis-manager" ;
119106import { createVariantAnalysisContentProvider } from "./variant-analysis/variant-analysis-content-provider" ;
120107import { VSCodeMockGitHubApiServer } from "./mocks/vscode-mock-gh-api-server" ;
121108import { VariantAnalysisResultsManager } from "./variant-analysis/variant-analysis-results-manager" ;
122109import { ExtensionApp } from "./common/vscode/vscode-app" ;
123- import { RepositoriesFilterSortStateWithIds } from "./pure/variant-analysis-filter-sort" ;
124110import { DbModule } from "./databases/db-module" ;
125111import { redactableError } from "./pure/errors" ;
126112import { QueryHistoryDirs } from "./query-history/query-history-dirs" ;
@@ -169,11 +155,28 @@ const extension = extensions.getExtension(extensionId);
169155/**
170156 * Return all commands that are not tied to the more specific managers.
171157 */
172- function getCommands ( ) : BaseCommands {
158+ function getCommands (
159+ cliServer : CodeQLCliServer ,
160+ queryRunner : QueryRunner ,
161+ ) : BaseCommands {
173162 return {
174163 "codeQL.openDocumentation" : async ( ) => {
175164 await env . openExternal ( Uri . parse ( "https://codeql.github.com/docs/" ) ) ;
176165 } ,
166+ "codeQL.restartQueryServer" : async ( ) =>
167+ withProgress (
168+ async ( progress : ProgressCallback , token : CancellationToken ) => {
169+ // We restart the CLI server too, to ensure they are the same version
170+ cliServer . restartCliServer ( ) ;
171+ await queryRunner . restartQueryServer ( progress , token ) ;
172+ void showAndLogInformationMessage ( "CodeQL Query Server restarted." , {
173+ outputLogger : queryServerLogger ,
174+ } ) ;
175+ } ,
176+ {
177+ title : "Restarting Query Server" ,
178+ } ,
179+ ) ,
177180 } ;
178181}
179182
@@ -819,7 +822,7 @@ async function activateWithInstalledDistribution(
819822 void extLogger . log ( "Registering top-level command palette commands." ) ;
820823
821824 const allCommands : AllCommands = {
822- ...getCommands ( ) ,
825+ ...getCommands ( cliServer , qs ) ,
823826 ...qhm . getCommands ( ) ,
824827 ...variantAnalysisManager . getCommands ( ) ,
825828 ...databaseUI . getCommands ( ) ,
@@ -834,6 +837,10 @@ async function activateWithInstalledDistribution(
834837 astTemplateProvider,
835838 cfgTemplateProvider,
836839 } ) ,
840+ ...getPackagingCommands ( {
841+ cliServer,
842+ } ) ,
843+ ...evalLogViewer . getCommands ( ) ,
837844 } ;
838845
839846 for ( const [ commandName , command ] of Object . entries ( allCommands ) ) {
@@ -860,78 +867,6 @@ async function activateWithInstalledDistribution(
860867 ) ;
861868 }
862869
863- ctx . subscriptions . push (
864- commandRunner (
865- "codeQL.copyVariantAnalysisRepoList" ,
866- async (
867- variantAnalysisId : number ,
868- filterSort ?: RepositoriesFilterSortStateWithIds ,
869- ) => {
870- await variantAnalysisManager . copyRepoListToClipboard (
871- variantAnalysisId ,
872- filterSort ,
873- ) ;
874- } ,
875- ) ,
876- ) ;
877-
878- ctx . subscriptions . push (
879- commandRunner (
880- "codeQL.monitorVariantAnalysis" ,
881- async ( variantAnalysis : VariantAnalysis , token : CancellationToken ) => {
882- await variantAnalysisManager . monitorVariantAnalysis (
883- variantAnalysis ,
884- token ,
885- ) ;
886- } ,
887- ) ,
888- ) ;
889-
890- ctx . subscriptions . push (
891- commandRunner (
892- "codeQL.autoDownloadVariantAnalysisResult" ,
893- async (
894- scannedRepo : VariantAnalysisScannedRepository ,
895- variantAnalysisSummary : VariantAnalysis ,
896- token : CancellationToken ,
897- ) => {
898- await variantAnalysisManager . enqueueDownload (
899- scannedRepo ,
900- variantAnalysisSummary ,
901- token ,
902- ) ;
903- } ,
904- ) ,
905- ) ;
906-
907- ctx . subscriptions . push (
908- commandRunner ( "codeQL.exportSelectedVariantAnalysisResults" , async ( ) => {
909- await exportSelectedVariantAnalysisResults ( variantAnalysisManager , qhm ) ;
910- } ) ,
911- ) ;
912-
913- ctx . subscriptions . push (
914- commandRunner (
915- "codeQL.loadVariantAnalysisRepoResults" ,
916- async ( variantAnalysisId : number , repositoryFullName : string ) => {
917- await variantAnalysisManager . loadResults (
918- variantAnalysisId ,
919- repositoryFullName ,
920- ) ;
921- } ,
922- ) ,
923- ) ;
924-
925- // The "openVariantAnalysisView" command is internal-only.
926- ctx . subscriptions . push (
927- commandRunner (
928- "codeQL.openVariantAnalysisView" ,
929- async ( variantAnalysisId : number ) => {
930- await variantAnalysisManager . showView ( variantAnalysisId ) ;
931- } ,
932- ) ,
933- ) ;
934-
935870 ctx . subscriptions . push (
936871 commandRunner ( "codeQL.openReferencedFile" , async ( selectedQuery : Uri ) => {
937872 await openReferencedFile ( qs , cliServer , selectedQuery ) ;
@@ -964,23 +899,6 @@ async function activateWithInstalledDistribution(
964899 } ) ,
965900 ) ;
966901
967- ctx . subscriptions . push (
968- commandRunnerWithProgress (
969- "codeQL.restartQueryServer" ,
970- async ( progress : ProgressCallback , token : CancellationToken ) => {
971- // We restart the CLI server too, to ensure they are the same version
972- cliServer . restartCliServer ( ) ;
973- await qs . restartQueryServer ( progress , token ) ;
974- void showAndLogInformationMessage ( "CodeQL Query Server restarted." , {
975- outputLogger : queryServerLogger ,
976- } ) ;
977- } ,
978- {
979- title : "Restarting Query Server" ,
980- } ,
981- ) ,
982- ) ;
983-
984902 ctx . subscriptions . push (
985903 commandRunner ( "codeQL.copyVersion" , async ( ) => {
986904 const text = `CodeQL extension version: ${
@@ -1013,28 +931,6 @@ async function activateWithInstalledDistribution(
1013931 } ) ,
1014932 ) ;
1015933
1016- ctx . subscriptions . push (
1017- commandRunnerWithProgress (
1018- "codeQL.installPackDependencies" ,
1019- async ( progress : ProgressCallback ) =>
1020- await handleInstallPackDependencies ( cliServer , progress ) ,
1021- {
1022- title : "Installing pack dependencies" ,
1023- } ,
1024- ) ,
1025- ) ;
1026-
1027- ctx . subscriptions . push (
1028- commandRunnerWithProgress (
1029- "codeQL.downloadPacks" ,
1030- async ( progress : ProgressCallback ) =>
1031- await handleDownloadPacks ( cliServer , progress ) ,
1032- {
1033- title : "Downloading packs" ,
1034- } ,
1035- ) ,
1036- ) ;
1037-
1038934 ctx . subscriptions . push (
1039935 commandRunner ( "codeQL.showLogs" , async ( ) => {
1040936 extLogger . show ( ) ;
0 commit comments