11import { join } from "path" ;
22import { ensureDir , writeFile } from "fs-extra" ;
33
4- import {
5- CancellationToken ,
6- commands ,
7- Uri ,
8- ViewColumn ,
9- window ,
10- workspace ,
11- } from "vscode" ;
4+ import { CancellationToken , Uri , ViewColumn , window , workspace } from "vscode" ;
125import {
136 ProgressCallback ,
147 UserCancellationException ,
@@ -35,6 +28,7 @@ import {
3528 RepositoriesFilterSortStateWithIds ,
3629} from "../pure/variant-analysis-filter-sort" ;
3730import { Credentials } from "../common/authentication" ;
31+ import { AppCommandManager } from "../common/commands" ;
3832
3933const MAX_VARIANT_ANALYSIS_EXPORT_PROGRESS_STEPS = 2 ;
4034
@@ -46,6 +40,7 @@ export async function exportVariantAnalysisResults(
4640 variantAnalysisManager : VariantAnalysisManager ,
4741 variantAnalysisId : number ,
4842 filterSort : RepositoriesFilterSortStateWithIds | undefined ,
43+ commandManager : AppCommandManager ,
4944 credentials : Credentials ,
5045) : Promise < void > {
5146 await withProgress (
@@ -149,6 +144,7 @@ export async function exportVariantAnalysisResults(
149144 getAnalysesResults ( ) ,
150145 repositories ?. length ?? 0 ,
151146 exportFormat ,
147+ commandManager ,
152148 credentials ,
153149 progress ,
154150 token ,
@@ -169,6 +165,7 @@ export async function exportVariantAnalysisAnalysisResults(
169165 > ,
170166 expectedAnalysesResultsCount : number ,
171167 exportFormat : "gist" | "local" ,
168+ commandManager : AppCommandManager ,
172169 credentials : Credentials ,
173170 progress : ProgressCallback ,
174171 token : CancellationToken ,
@@ -199,6 +196,7 @@ export async function exportVariantAnalysisAnalysisResults(
199196 description ,
200197 markdownFiles ,
201198 exportFormat ,
199+ commandManager ,
202200 credentials ,
203201 progress ,
204202 token ,
@@ -243,6 +241,7 @@ export async function exportResults(
243241 description : string ,
244242 markdownFiles : MarkdownFile [ ] ,
245243 exportFormat : "gist" | "local" ,
244+ commandManager : AppCommandManager ,
246245 credentials : Credentials ,
247246 progress ?: ProgressCallback ,
248247 token ?: CancellationToken ,
@@ -255,6 +254,7 @@ export async function exportResults(
255254 await exportToGist (
256255 description ,
257256 markdownFiles ,
257+ commandManager ,
258258 credentials ,
259259 progress ,
260260 token ,
@@ -263,6 +263,7 @@ export async function exportResults(
263263 await exportToLocalMarkdown (
264264 exportedResultsPath ,
265265 markdownFiles ,
266+ commandManager ,
266267 progress ,
267268 token ,
268269 ) ;
@@ -272,6 +273,7 @@ export async function exportResults(
272273export async function exportToGist (
273274 description : string ,
274275 markdownFiles : MarkdownFile [ ] ,
276+ commandManager : AppCommandManager ,
275277 credentials : Credentials ,
276278 progress ?: ProgressCallback ,
277279 token ?: CancellationToken ,
@@ -303,7 +305,7 @@ export async function exportToGist(
303305 if ( ! shouldOpenGist ) {
304306 return ;
305307 }
306- return commands . executeCommand ( "vscode.open" , Uri . parse ( gistUrl ) ) ;
308+ return commandManager . execute ( "vscode.open" , Uri . parse ( gistUrl ) ) ;
307309 } ) ;
308310 }
309311}
@@ -334,6 +336,7 @@ const buildVariantAnalysisGistDescription = (
334336async function exportToLocalMarkdown (
335337 exportedResultsPath : string ,
336338 markdownFiles : MarkdownFile [ ] ,
339+ commandManager : AppCommandManager ,
337340 progress ?: ProgressCallback ,
338341 token ?: CancellationToken ,
339342) {
@@ -366,6 +369,6 @@ async function exportToLocalMarkdown(
366369 const summaryFilePath = join ( exportedResultsPath , "_summary.md" ) ;
367370 const summaryFile = await workspace . openTextDocument ( summaryFilePath ) ;
368371 await window . showTextDocument ( summaryFile , ViewColumn . One ) ;
369- await commands . executeCommand ( "revealFileInOS" , Uri . file ( summaryFilePath ) ) ;
372+ await commandManager . execute ( "revealFileInOS" , Uri . file ( summaryFilePath ) ) ;
370373 } ) ;
371374}
0 commit comments