Skip to content

Commit 1103437

Browse files
Jami CogswellJami Cogswell
authored andcommitted
Add 'View Autofixes' query history command for variant analysis items
1 parent 8dfcf8b commit 1103437

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

extensions/ql-vscode/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,10 @@
958958
"command": "codeQLQueryHistory.copyRepoList",
959959
"title": "Copy Repository List"
960960
},
961+
{
962+
"command": "codeQLQueryHistory.viewAutofixes",
963+
"title": "View Autofixes"
964+
},
961965
{
962966
"command": "codeQLQueryResults.down",
963967
"title": "CodeQL: Navigate Down in Local Result Viewer"
@@ -1296,6 +1300,11 @@
12961300
"group": "1_queryHistory@1",
12971301
"when": "viewItem == remoteResultsItem"
12981302
},
1303+
{
1304+
"command": "codeQLQueryHistory.viewAutofixes",
1305+
"group": "1_queryHistory@2",
1306+
"when": "viewItem == remoteResultsItem"
1307+
},
12991308
{
13001309
"command": "codeQLQueries.runLocalQueryFromQueriesPanel",
13011310
"group": "inline",
@@ -1706,6 +1715,10 @@
17061715
"command": "codeQLQueryHistory.copyRepoList",
17071716
"when": "false"
17081717
},
1718+
{
1719+
"command": "codeQLQueryHistory.viewAutofixes",
1720+
"when": "false"
1721+
},
17091722
{
17101723
"command": "codeQLQueryHistory.showQueryText",
17111724
"when": "false"

extensions/ql-vscode/src/common/commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export type QueryHistoryCommands = {
197197
"codeQLQueryHistory.itemClicked": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
198198
"codeQLQueryHistory.openOnGithub": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
199199
"codeQLQueryHistory.copyRepoList": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
200+
"codeQLQueryHistory.viewAutofixes": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
200201

201202
// Commands in the command palette
202203
"codeQL.exportSelectedVariantAnalysisResults": () => Promise<void>;

extensions/ql-vscode/src/query-history/query-history-manager.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ export class QueryHistoryManager extends DisposableObject {
338338
this.handleOpenOnGithub.bind(this),
339339
"query",
340340
),
341+
"codeQLQueryHistory.viewAutofixes": createSingleSelectionCommand(
342+
this.app.logger,
343+
this.handleViewAutofixes.bind(this),
344+
"query",
345+
),
341346
"codeQLQueryHistory.copyRepoList": createSingleSelectionCommand(
342347
this.app.logger,
343348
this.handleCopyRepoList.bind(this),
@@ -1052,6 +1057,14 @@ export class QueryHistoryManager extends DisposableObject {
10521057
);
10531058
}
10541059

1060+
async handleViewAutofixes(item: QueryHistoryInfo) {
1061+
if (item.t !== "variant-analysis") {
1062+
return;
1063+
}
1064+
1065+
await this.variantAnalysisManager.viewAutofixes(item.variantAnalysis.id);
1066+
}
1067+
10551068
async handleCopyRepoList(item: QueryHistoryInfo) {
10561069
if (item.t !== "variant-analysis") {
10571070
return;

extensions/ql-vscode/src/variant-analysis/variant-analysis-manager.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,11 @@ export class VariantAnalysisManager
967967
);
968968
}
969969

970-
public async viewAutofixes() {
970+
public async viewAutofixes(variantAnalysisId: number) {
971+
const variantAnalysis = this.variantAnalyses.get(variantAnalysisId);
972+
if (!variantAnalysis) {
973+
throw new Error(`No variant analysis with id: ${variantAnalysisId}`);
974+
}
971975
// TODO
972976
}
973977

0 commit comments

Comments
 (0)