Skip to content

Commit 0afe982

Browse files
authored
Merge branch 'main' into github-action/bump-cli
2 parents 7c18934 + d4fa420 commit 0afe982

File tree

62 files changed

+1315
-784
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1315
-784
lines changed

extensions/ql-vscode/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
## [UNRELEASED]
44

5+
- Added ability to filter repositories for a variant analysis to only those that have results [#2343](https://github.com/github/vscode-codeql/pull/2343)
56
- Add new configuration option to allow downloading databases from http, non-secure servers. [#2332](https://github.com/github/vscode-codeql/pull/2332)
7+
- Remove title actions from the query history panel that depended on history items being selected. [#2350](https://github.com/github/vscode-codeql/pull/2350)
68

79
## 1.8.2 - 12 April 2023
810

extensions/ql-vscode/package.json

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,12 @@
340340
"type": "boolean",
341341
"default": false,
342342
"description": "Allow database to be downloaded via HTTP. Warning: enabling this option will allow downloading from insecure servers."
343+
},
344+
"codeQL.createQuery.folder": {
345+
"type": "string",
346+
"default": "",
347+
"patternErrorMessage": "Please enter a valid folder",
348+
"markdownDescription": "The name of the folder where we want to create queries and query packs via the \"CodeQL: Create Query\" command. The folder should exist."
343349
}
344350
}
345351
},
@@ -627,11 +633,6 @@
627633
"command": "codeQL.checkForUpdatesToCLI",
628634
"title": "CodeQL: Check for CLI Updates"
629635
},
630-
{
631-
"command": "codeQLQueryHistory.openQueryTitleMenu",
632-
"title": "View Query",
633-
"icon": "$(edit)"
634-
},
635636
{
636637
"command": "codeQLQueryHistory.openQueryContextMenu",
637638
"title": "View Query",
@@ -642,11 +643,6 @@
642643
"title": "Open Query Results",
643644
"icon": "$(preview)"
644645
},
645-
{
646-
"command": "codeQLQueryHistory.removeHistoryItemTitleMenu",
647-
"title": "Delete",
648-
"icon": "$(trash)"
649-
},
650646
{
651647
"command": "codeQLQueryHistory.removeHistoryItemContextMenu",
652648
"title": "Delete",
@@ -847,21 +843,6 @@
847843
"when": "view == codeQLDatabases",
848844
"group": "navigation"
849845
},
850-
{
851-
"command": "codeQLQueryHistory.openQueryTitleMenu",
852-
"when": "view == codeQLQueryHistory",
853-
"group": "navigation"
854-
},
855-
{
856-
"command": "codeQLQueryHistory.itemClicked",
857-
"when": "view == codeQLQueryHistory",
858-
"group": "navigation"
859-
},
860-
{
861-
"command": "codeQLQueryHistory.removeHistoryItemTitleMenu",
862-
"when": "view == codeQLQueryHistory",
863-
"group": "navigation"
864-
},
865846
{
866847
"command": "codeQLQueryHistory.sortByName",
867848
"when": "view == codeQLQueryHistory",
@@ -1304,18 +1285,10 @@
13041285
"command": "codeQLDatabases.upgradeDatabase",
13051286
"when": "false"
13061287
},
1307-
{
1308-
"command": "codeQLQueryHistory.openQueryTitleMenu",
1309-
"when": "false"
1310-
},
13111288
{
13121289
"command": "codeQLQueryHistory.openQueryContextMenu",
13131290
"when": "false"
13141291
},
1315-
{
1316-
"command": "codeQLQueryHistory.removeHistoryItemTitleMenu",
1317-
"when": "false"
1318-
},
13191292
{
13201293
"command": "codeQLQueryHistory.removeHistoryItemContextMenu",
13211294
"when": "false"
@@ -1446,7 +1419,7 @@
14461419
},
14471420
{
14481421
"command": "codeQL.createQuery",
1449-
"when": "config.codeQL.canary"
1422+
"when": "config.codeQL.codespacesTemplate"
14501423
},
14511424
{
14521425
"command": "codeQLTests.acceptOutputContextTestItem",

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

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,6 @@ import type {
1313
} from "../variant-analysis/shared/variant-analysis";
1414
import type { QLDebugConfiguration } from "../debugger/debug-configuration";
1515

16-
// A command function matching the signature that VS Code calls when
17-
// a command is invoked from the title bar of a TreeView with
18-
// canSelectMany set to true.
19-
//
20-
// It is possible to get any combination of singleItem and multiSelect
21-
// to be undefined. This is because it is possible to click a title bar
22-
// option without interacting with any individual items first, or even
23-
// when there are no items present at all.
24-
// If both singleItem and multiSelect are defined, then singleItem will
25-
// be contained within multiSelect.
26-
export type TreeViewTitleMultiSelectionCommandFunction<Item> = (
27-
singleItem: Item | undefined,
28-
multiSelect: Item[] | undefined,
29-
) => Promise<void>;
30-
3116
// A command function matching the signature that VS Code calls when
3217
// a command is invoked from a context menu on a TreeView with
3318
// canSelectMany set to true.
@@ -176,9 +161,7 @@ export type QueryHistoryCommands = {
176161
"codeQLQueryHistory.sortByCount": () => Promise<void>;
177162

178163
// Commands in the context menu or in the hover menu
179-
"codeQLQueryHistory.openQueryTitleMenu": TreeViewTitleMultiSelectionCommandFunction<QueryHistoryInfo>;
180164
"codeQLQueryHistory.openQueryContextMenu": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
181-
"codeQLQueryHistory.removeHistoryItemTitleMenu": TreeViewTitleMultiSelectionCommandFunction<QueryHistoryInfo>;
182165
"codeQLQueryHistory.removeHistoryItemContextMenu": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
183166
"codeQLQueryHistory.removeHistoryItemContextInline": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
184167
"codeQLQueryHistory.renameItem": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
@@ -195,7 +178,7 @@ export type QueryHistoryCommands = {
195178
"codeQLQueryHistory.viewCsvAlerts": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
196179
"codeQLQueryHistory.viewSarifAlerts": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
197180
"codeQLQueryHistory.viewDil": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
198-
"codeQLQueryHistory.itemClicked": TreeViewTitleMultiSelectionCommandFunction<QueryHistoryInfo>;
181+
"codeQLQueryHistory.itemClicked": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
199182
"codeQLQueryHistory.openOnGithub": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
200183
"codeQLQueryHistory.copyRepoList": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
201184

extensions/ql-vscode/src/config.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,3 +619,19 @@ export const ALLOW_HTTP_SETTING = new Setting(
619619
export function allowHttp(): boolean {
620620
return ALLOW_HTTP_SETTING.getValue<boolean>() || false;
621621
}
622+
623+
/**
624+
* The name of the folder where we want to create skeleton wizard QL packs.
625+
**/
626+
const SKELETON_WIZARD_FOLDER = new Setting(
627+
"folder",
628+
new Setting("createQuery", ROOT_SETTING),
629+
);
630+
631+
export function getSkeletonWizardFolder(): string | undefined {
632+
return SKELETON_WIZARD_FOLDER.getValue<string>() || undefined;
633+
}
634+
635+
export async function setSkeletonWizardFolder(folder: string | undefined) {
636+
await SKELETON_WIZARD_FOLDER.updateValue(folder, ConfigurationTarget.Global);
637+
}

extensions/ql-vscode/src/contextual/locationFinder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
} from "./queryResolver";
2121
import { CancellationToken, LocationLink, Uri } from "vscode";
2222
import { QueryOutputDir } from "../run-queries-shared";
23-
import { QueryRunner } from "../queryRunner";
23+
import { QueryRunner } from "../query-server";
2424
import { QueryResultType } from "../pure/new-messages";
2525

2626
export const SELECT_QUERY_NAME = "#select";

extensions/ql-vscode/src/contextual/queryResolver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { DatabaseItem } from "../local-databases";
1616
import { extLogger, TeeLogger } from "../common";
1717
import { CancellationToken } from "vscode";
1818
import { ProgressCallback } from "../progress";
19-
import { CoreCompletedQuery, QueryRunner } from "../queryRunner";
19+
import { CoreCompletedQuery, QueryRunner } from "../query-server";
2020
import { redactableError } from "../pure/errors";
2121
import { QLPACK_FILENAMES } from "../pure/ql";
2222

extensions/ql-vscode/src/contextual/templateProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232
runContextualQuery,
3333
} from "./queryResolver";
3434
import { isCanary, NO_CACHE_AST_VIEWER } from "../config";
35-
import { CoreCompletedQuery, QueryRunner } from "../queryRunner";
35+
import { CoreCompletedQuery, QueryRunner } from "../query-server";
3636

3737
/**
3838
* Runs templated CodeQL queries to find definitions in

extensions/ql-vscode/src/data-extensions-editor/data-extensions-editor-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ExtensionContext } from "vscode";
22
import { DataExtensionsEditorView } from "./data-extensions-editor-view";
33
import { DataExtensionsEditorCommands } from "../common/commands";
44
import { CliVersionConstraint, CodeQLCliServer } from "../cli";
5-
import { QueryRunner } from "../queryRunner";
5+
import { QueryRunner } from "../query-server";
66
import { DatabaseManager } from "../local-databases";
77
import { ensureDir } from "fs-extra";
88
import { join } from "path";

extensions/ql-vscode/src/data-extensions-editor/data-extensions-editor-view.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
ToDataExtensionsEditorMessage,
1414
} from "../pure/interface-types";
1515
import { ProgressUpdate } from "../progress";
16-
import { QueryRunner } from "../queryRunner";
16+
import { QueryRunner } from "../query-server";
1717
import {
1818
showAndLogErrorMessage,
1919
showAndLogExceptionWithTelemetry,
@@ -35,7 +35,7 @@ import { readQueryResults, runQuery } from "./external-api-usage-query";
3535
import { createDataExtensionYaml, loadDataExtensionYaml } from "./yaml";
3636
import { ExternalApiUsage } from "./external-api-usage";
3737
import { ModeledMethod } from "./modeled-method";
38-
import { ExtensionPackModelFile } from "./extension-pack-picker";
38+
import { ExtensionPackModelFile } from "./shared/extension-pack";
3939

4040
function getQlSubmoduleFolder(): WorkspaceFolder | undefined {
4141
const workspaceFolder = workspace.workspaceFolders?.find(
@@ -118,7 +118,7 @@ export class DataExtensionsEditorView extends AbstractWebview<
118118
msg.externalApiUsages,
119119
msg.modeledMethods,
120120
);
121-
await this.loadExternalApiUsages();
121+
await Promise.all([this.setViewState(), this.loadExternalApiUsages()]);
122122

123123
break;
124124
case "generateExternalApi":
@@ -134,16 +134,22 @@ export class DataExtensionsEditorView extends AbstractWebview<
134134
super.onWebViewLoaded();
135135

136136
await Promise.all([
137-
this.postMessage({
138-
t: "setDataExtensionEditorInitialData",
139-
extensionPackName: this.modelFile.extensionPack.name,
140-
modelFilename: this.modelFile.filename,
141-
}),
137+
this.setViewState(),
142138
this.loadExternalApiUsages(),
143139
this.loadExistingModeledMethods(),
144140
]);
145141
}
146142

143+
private async setViewState(): Promise<void> {
144+
await this.postMessage({
145+
t: "setDataExtensionEditorViewState",
146+
viewState: {
147+
extensionPackModelFile: this.modelFile,
148+
modelFileExists: await pathExists(this.modelFile.filename),
149+
},
150+
});
151+
}
152+
147153
protected async jumpToUsage(
148154
location: ResolvableLocationValue,
149155
): Promise<void> {

extensions/ql-vscode/src/data-extensions-editor/extension-pack-picker.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { ProgressCallback } from "../progress";
1313
import { DatabaseItem } from "../local-databases";
1414
import { getQlPackPath, QLPACK_FILENAMES } from "../pure/ql";
1515
import { getErrorMessage } from "../pure/helpers-pure";
16+
import { ExtensionPack, ExtensionPackModelFile } from "./shared/extension-pack";
1617

1718
const maxStep = 3;
1819

@@ -22,22 +23,6 @@ const packNameRegex = new RegExp(
2223
);
2324
const packNameLength = 128;
2425

25-
export interface ExtensionPack {
26-
path: string;
27-
yamlPath: string;
28-
29-
name: string;
30-
version: string;
31-
32-
extensionTargets: Record<string, string>;
33-
dataExtensions: string[];
34-
}
35-
36-
export interface ExtensionPackModelFile {
37-
filename: string;
38-
extensionPack: ExtensionPack;
39-
}
40-
4126
export async function pickExtensionPackModelFile(
4227
cliServer: Pick<CodeQLCliServer, "resolveQlpacks" | "resolveExtensions">,
4328
databaseItem: Pick<DatabaseItem, "name" | "language">,

0 commit comments

Comments
 (0)