@@ -5,6 +5,9 @@ import type { Credentials } from "../common/authentication";
55import type { NotificationLogger } from "../common/logging" ;
66import type { App } from "../common/app" ;
77import type { CodeQLCliServer } from "../codeql-cli/cli" ;
8+ import { pathExists } from "fs-extra" ;
9+ import { withProgress , progressUpdate } from "../common/vscode/progress" ;
10+ import type { ProgressCallback } from "../common/vscode/progress" ;
811
912/**
1013 * Generates autofixes for the results of a variant analysis.
@@ -19,5 +22,34 @@ export async function viewAutofixesForVariantAnalysisResults(
1922 app : App ,
2023 cliServer : CodeQLCliServer ,
2124) : Promise < void > {
22- // TODO
25+ await withProgress (
26+ async ( progress : ProgressCallback ) => {
27+ // Get the path to the local autofix installation.
28+ progress ( progressUpdate ( 1 , 4 , `Checking for local autofix installation` ) ) ;
29+ const localAutofixPath = findLocalAutofix ( ) ;
30+
31+ // TODO
32+ } ,
33+ {
34+ title : "Generating Autofixes" ,
35+ cancellable : false , // not cancellable for now
36+ } ,
37+ ) ;
38+ }
39+
40+ /**
41+ * Finds the local autofix installation path from the AUTOFIX_PATH environment variable.
42+ * Throws an error if the path is not set or does not exist.
43+ * @returns An object containing the local autofix path.
44+ * @throws Error if the AUTOFIX_PATH environment variable is not set or the path does not exist.
45+ */
46+ function findLocalAutofix ( ) : string {
47+ const localAutofixPath = process . env . AUTOFIX_PATH ;
48+ if ( ! localAutofixPath ) {
49+ throw new Error ( "Path to local autofix installation not found." ) ;
50+ }
51+ if ( ! pathExists ( localAutofixPath ) ) {
52+ throw new Error ( `Local autofix path ${ localAutofixPath } does not exist.` ) ;
53+ }
54+ return localAutofixPath ;
2355}
0 commit comments