@@ -51,7 +51,11 @@ import {
5151import { readFile , readJson , remove , pathExists , outputJson } from "fs-extra" ;
5252import { EOL } from "os" ;
5353import { cancelVariantAnalysis } from "./gh-api/gh-actions-api-client" ;
54- import { ProgressCallback , UserCancellationException } from "../commandRunner" ;
54+ import {
55+ ProgressCallback ,
56+ UserCancellationException ,
57+ withProgress ,
58+ } from "../commandRunner" ;
5559import { CodeQLCliServer } from "../cli" ;
5660import {
5761 defaultFilterSortState ,
@@ -132,18 +136,44 @@ export class VariantAnalysisManager
132136 "codeQL.openVariantAnalysisLogs" : async ( variantAnalysisId : number ) => {
133137 await this . openVariantAnalysisLogs ( variantAnalysisId ) ;
134138 } ,
139+ "codeQL.runVariantAnalysis" : async ( uri ?: Uri ) =>
140+ this . runVariantAnalysisFromCommand ( uri ) ,
141+ // Since we are tracking extension usage through commands, this command mirrors the "codeQL.runVariantAnalysis" command
142+ "codeQL.runVariantAnalysisContextEditor" : async ( uri ?: Uri ) =>
143+ this . runVariantAnalysisFromCommand ( uri ) ,
135144 } ;
136145 }
137146
138147 get commandManager ( ) : ExtensionCommandManager {
139148 return this . app . commandManager ;
140149 }
141150
151+ private async runVariantAnalysisFromCommand ( uri ?: Uri ) {
152+ return withProgress (
153+ async ( progress , token ) =>
154+ this . runVariantAnalysis (
155+ uri || Window . activeTextEditor ?. document . uri ,
156+ progress ,
157+ token ,
158+ ) ,
159+ {
160+ title : "Run Variant Analysis" ,
161+ cancellable : true ,
162+ } ,
163+ ) ;
164+ }
165+
142166 public async runVariantAnalysis (
143167 uri : Uri | undefined ,
144168 progress : ProgressCallback ,
145169 token : CancellationToken ,
146170 ) : Promise < void > {
171+ progress ( {
172+ maxStep : 5 ,
173+ step : 0 ,
174+ message : "Getting credentials" ,
175+ } ) ;
176+
147177 const {
148178 actionBranch,
149179 base64Pack,
0 commit comments