Skip to content

Commit f4b37c9

Browse files
Merge branch 'main' into robertbrignull/convert-ResultsApp
2 parents 3ff649a + bf0032d commit f4b37c9

File tree

67 files changed

+77094
-641
lines changed

Some content is hidden

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

67 files changed

+77094
-641
lines changed

docs/test-plan.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ This requires running a MRVA query and seeing the results view.
378378
1. Make changes via config file (ensure JSON schema is helping out)
379379
1. Close and re-open VS Code (ensure lists are there)
380380
1. Collapse/expand tree nodes
381+
1. Create a new list, right click and select "Add repositories with GitHub Code Search". Enter the language 'python' and the query "UserMixin". This should show a rate limiting notification after a while but eventually populate the list with roughly 770 items.
381382

382383
Error cases that trigger an error notification:
383384

extensions/ql-vscode/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# CodeQL for Visual Studio Code: Changelog
22

3+
## [UNRELEASED]
4+
35
## 1.8.7 - 29 June 2023
46

57
- Show a run button on the file tab for query files, that will start a local query. This button will only show when a local database is selected in the extension. [#2544](https://github.com/github/vscode-codeql/pull/2544)

extensions/ql-vscode/package-lock.json

Lines changed: 78 additions & 94 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/ql-vscode/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "CodeQL for Visual Studio Code",
55
"author": "GitHub",
66
"private": true,
7-
"version": "1.8.7",
7+
"version": "1.8.8",
88
"publisher": "GitHub",
99
"license": "MIT",
1010
"icon": "media/VS-marketplace-CodeQL-icon.png",
@@ -1699,7 +1699,7 @@
16991699
},
17001700
{
17011701
"view": "codeQLQueries",
1702-
"contents": "This workspace doesn't contain any CodeQL queries at the moment."
1702+
"contents": "Looking for queries..."
17031703
},
17041704
{
17051705
"view": "codeQLDatabases",
@@ -1780,7 +1780,7 @@
17801780
"vscode-languageclient": "^8.0.2",
17811781
"vscode-test-adapter-api": "~1.7.0",
17821782
"vscode-test-adapter-util": "~0.7.0",
1783-
"zip-a-folder": "~1.1.3"
1783+
"zip-a-folder": "~2.0.0"
17841784
},
17851785
"devDependencies": {
17861786
"@babel/core": "^7.18.13",

extensions/ql-vscode/src/code-tour.ts renamed to extensions/ql-vscode/src/code-tour/code-tour.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { AppCommandManager } from "./common/commands";
1+
import { AppCommandManager } from "../common/commands";
22
import { Uri, workspace } from "vscode";
33
import { join } from "path";
44
import { pathExists } from "fs-extra";
5-
import { isCodespacesTemplate } from "./config";
6-
import { showBinaryChoiceDialog } from "./common/vscode/dialog";
7-
import { extLogger } from "./common/logging/vscode";
5+
import { isCodespacesTemplate } from "../config";
6+
import { showBinaryChoiceDialog } from "../common/vscode/dialog";
7+
import { extLogger } from "../common/logging/vscode";
88

99
/**
1010
* Check if the current workspace is the CodeTour and open the workspace folder.

extensions/ql-vscode/src/common/vscode/file-path-discovery.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ interface PathData {
3434
* relevant, and what extra data to compute for each file.
3535
*/
3636
export abstract class FilePathDiscovery<T extends PathData> extends Discovery {
37+
/**
38+
* Has `discover` been called. This allows distinguishing between
39+
* "no paths found" and not having scanned yet.
40+
*/
41+
private discoverHasCompletedOnce = false;
42+
3743
/** The set of known paths and associated data that we are tracking */
3844
private pathData: T[] = [];
3945

@@ -73,7 +79,10 @@ export abstract class FilePathDiscovery<T extends PathData> extends Discovery {
7379
this.push(this.watcher.onDidChange(this.fileChanged.bind(this)));
7480
}
7581

76-
protected getPathData(): ReadonlyArray<Readonly<T>> {
82+
protected getPathData(): ReadonlyArray<Readonly<T>> | undefined {
83+
if (!this.discoverHasCompletedOnce) {
84+
return undefined;
85+
}
7786
return this.pathData;
7887
}
7988

@@ -118,7 +127,8 @@ export abstract class FilePathDiscovery<T extends PathData> extends Discovery {
118127
});
119128

120129
this.updateWatchers();
121-
return this.refresh();
130+
await this.refresh();
131+
this.onDidChangePathDataEmitter.fire();
122132
}
123133

124134
private workspaceFoldersChanged(event: WorkspaceFoldersChangeEvent) {
@@ -171,6 +181,7 @@ export abstract class FilePathDiscovery<T extends PathData> extends Discovery {
171181
}
172182
}
173183

184+
this.discoverHasCompletedOnce = true;
174185
if (pathsUpdated) {
175186
this.onDidChangePathDataEmitter.fire();
176187
}

extensions/ql-vscode/src/data-extensions-editor/external-api-usage.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,24 @@ export type ExternalApiUsage = {
1111
*/
1212
library: string;
1313
/**
14-
* Contains the full method signature, e.g. `org.sql2o.Connection#createQuery(String)`
14+
* A unique signature that can be used to identify this external API usage.
15+
*
16+
* The signature contains the package name, type name, method name, and method parameters
17+
* in the form "packageName.typeName#methodName(methodParameters)".
18+
* e.g. `org.sql2o.Connection#createQuery(String)`
1519
*/
1620
signature: string;
1721
packageName: string;
1822
typeName: string;
1923
methodName: string;
24+
/**
25+
* The method parameters, including enclosing parentheses, e.g. `(String, String)`
26+
*/
2027
methodParameters: string;
28+
/**
29+
* Is this method already supported by CodeQL standard libraries.
30+
* If so, there is no need for the user to model it themselves.
31+
*/
2132
supported: boolean;
2233
usages: Call[];
2334
};

extensions/ql-vscode/src/databases/local-databases/database-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
} from "../../common/vscode/workspace-folders";
2222
import { isQueryLanguage } from "../../common/query-language";
2323
import { existsSync } from "fs";
24-
import { QlPackGenerator } from "../../qlpack-generator";
24+
import { QlPackGenerator } from "../../local-queries/qlpack-generator";
2525
import { asError, getErrorMessage } from "../../common/helpers-pure";
2626
import { DatabaseItem, PersistedDatabaseItem } from "./database-item";
2727
import { redactableError } from "../../common/errors";

extensions/ql-vscode/src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ import {
5656
GithubRateLimitedError,
5757
} from "./codeql-cli/distribution";
5858
import { tmpDir, tmpDirDisposal } from "./tmp-dir";
59-
import { prepareCodeTour } from "./code-tour";
59+
import { prepareCodeTour } from "./code-tour/code-tour";
6060
import {
6161
showBinaryChoiceDialog,
6262
showInformationMessageWithAction,

extensions/ql-vscode/src/local-queries/local-queries.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import { CliVersionConstraint, CodeQLCliServer } from "../codeql-cli/cli";
4444
import { LocalQueryCommands } from "../common/commands";
4545
import { App } from "../common/app";
4646
import { DisposableObject } from "../common/disposable-object";
47-
import { SkeletonQueryWizard } from "../skeleton-query-wizard";
47+
import { SkeletonQueryWizard } from "./skeleton-query-wizard";
4848
import { LocalQueryRun } from "./local-query-run";
4949
import { createMultiSelectionCommand } from "../common/vscode/selection-commands";
5050
import { findLanguage } from "../codeql-cli/query-language";
@@ -132,15 +132,20 @@ export class LocalQueries extends DisposableObject {
132132
private async runQueryFromQueriesPanel(
133133
queryTreeViewItem: QueryTreeViewItem,
134134
): Promise<void> {
135-
await this.runQuery(Uri.file(queryTreeViewItem.path));
135+
if (queryTreeViewItem.path !== undefined) {
136+
await this.runQuery(Uri.file(queryTreeViewItem.path));
137+
}
136138
}
137139

138140
private async runQueriesFromQueriesPanel(
139141
queryTreeViewItem: QueryTreeViewItem,
140142
): Promise<void> {
141-
const uris = queryTreeViewItem.children.map((child) =>
142-
Uri.file(child.path),
143-
);
143+
const uris = [];
144+
for (const child of queryTreeViewItem.children) {
145+
if (child.path !== undefined) {
146+
uris.push(Uri.file(child.path));
147+
}
148+
}
144149
await this.runQueries(uris);
145150
}
146151

0 commit comments

Comments
 (0)