Skip to content

Commit b67efee

Browse files
author
Dave Bartolomeo
authored
Merge pull request #3232 from github/dbartol/new-test-api
Switch to built-in VS Code test UI unconditionally
2 parents c065c44 + 4b3a008 commit b67efee

14 files changed

Lines changed: 107 additions & 571 deletions

File tree

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@ To see what has changed in the last few versions of the extension, see the [Chan
2121

2222
This project will track new feature development in CodeQL and, whenever appropriate, bring that functionality to the Visual Studio Code experience.
2323

24-
## Dependencies
25-
26-
This extension depends on the following two extensions for required functionality. They will be installed automatically when you install VS Code CodeQL.
27-
28-
- [Test Adapter Converter](https://marketplace.visualstudio.com/items?itemName=ms-vscode.test-adapter-converter)
29-
- [Test Explorer UI](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-test-explorer)
30-
3124
## Contributing
3225

3326
This project welcomes contributions. See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to build, install, and contribute.

extensions/ql-vscode/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
## [UNRELEASED]
44

55
- If you run a query without having selected a database, we show a more intuitive prompt to help you select a database. [#3214](https://github.com/github/vscode-codeql/pull/3214)
6+
- The UI for browsing and running CodeQL tests has moved to use VS Code's built-in test UI. This makes the CodeQL test UI more consistent with the test UIs for other languages.
7+
This change means that this extension no longer depends on the "Test Explorer UI" and "Test Adapter Converter" extensions. You can uninstall those two extensions if they are
8+
not being used by any other extensions you may have installed.
69

710
## 1.12.0 - 11 January 2024
811

extensions/ql-vscode/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ For information about other configurations, see the separate [CodeQL help](https
1717
### Quick start: Installing and configuring the extension
1818

1919
1. [Install the extension](#installing-the-extension).
20-
*Note: vscode-codeql installs the following dependencies for required functionality: [Test Adapter Converter](https://marketplace.visualstudio.com/items?itemName=ms-vscode.test-adapter-converter), [Test Explorer UI](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-test-explorer).*
21-
2220
1. [Check access to the CodeQL CLI](#checking-access-to-the-codeql-cli).
2321
1. [Clone the CodeQL starter workspace](#cloning-the-codeql-starter-workspace).
2422

extensions/ql-vscode/package-lock.json

Lines changed: 0 additions & 27 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: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"Programming Languages"
2222
],
2323
"extensionDependencies": [
24-
"hbenl.vscode-test-explorer",
2524
"vscode.git"
2625
],
2726
"capabilities": {
@@ -1938,8 +1937,6 @@
19381937
"vscode-extension-telemetry": "^0.1.6",
19391938
"vscode-jsonrpc": "^8.0.2",
19401939
"vscode-languageclient": "^8.0.2",
1941-
"vscode-test-adapter-api": "^1.7.0",
1942-
"vscode-test-adapter-util": "^0.7.0",
19431940
"yauzl": "^2.10.0",
19441941
"zip-a-folder": "^3.1.3"
19451942
},

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import type { CommandManager } from "../packages/commands";
2-
import type { Uri, Range, TextDocumentShowOptions } from "vscode";
2+
import type { Uri, Range, TextDocumentShowOptions, TestItem } from "vscode";
33
import type { AstItem } from "../language-support";
44
import type { DbTreeViewItem } from "../databases/ui/db-tree-view-item";
55
import type { DatabaseItem } from "../databases/local-databases";
66
import type { QueryHistoryInfo } from "../query-history/query-history-info";
7-
import type { TestTreeNode } from "../query-testing/test-tree-node";
87
import type {
98
VariantAnalysis,
109
VariantAnalysisScannedRepository,
@@ -334,11 +333,9 @@ export type SummaryLanguageSupportCommands = {
334333
};
335334

336335
export type TestUICommands = {
337-
"codeQLTests.showOutputDifferences": (node: TestTreeNode) => Promise<void>;
338-
"codeQLTests.acceptOutput": (node: TestTreeNode) => Promise<void>;
339-
"codeQLTests.acceptOutputContextTestItem": (
340-
node: TestTreeNode,
341-
) => Promise<void>;
336+
"codeQLTests.showOutputDifferences": (node: TestItem) => Promise<void>;
337+
"codeQLTests.acceptOutput": (node: TestItem) => Promise<void>;
338+
"codeQLTests.acceptOutputContextTestItem": (node: TestItem) => Promise<void>;
342339
};
343340

344341
export type MockGitHubApiServerCommands = {

extensions/ql-vscode/src/extension.ts

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import { arch, homedir, platform } from "os";
1515
import { ensureDir } from "fs-extra";
1616
import { join } from "path";
1717
import { dirSync } from "tmp-promise";
18-
import type { TestHub } from "vscode-test-adapter-api";
19-
import { testExplorerExtensionId } from "vscode-test-adapter-api";
2018
import { lt, parse } from "semver";
2119
import { watch } from "chokidar";
2220
import {
@@ -28,7 +26,6 @@ import {
2826
CliConfigListener,
2927
DistributionConfigListener,
3028
GitHubDatabaseConfigListener,
31-
isCanary,
3229
joinOrderWarningThreshold,
3330
QueryHistoryConfigListener,
3431
QueryServerConfigListener,
@@ -90,8 +87,6 @@ import {
9087
} from "./common/logging/vscode";
9188
import { QueryHistoryManager } from "./query-history/query-history-manager";
9289
import type { CompletedLocalQueryInfo } from "./query-results";
93-
import { QLTestAdapterFactory } from "./query-testing/test-adapter";
94-
import { TestUIService } from "./query-testing/test-ui";
9590
import { CompareView } from "./compare/compare-view";
9691
import {
9792
initializeTelemetry,
@@ -130,7 +125,6 @@ import { DebuggerUI } from "./debugger/debugger-ui";
130125
import { ModelEditorModule } from "./model-editor/model-editor-module";
131126
import { TestManager } from "./query-testing/test-manager";
132127
import { TestRunner } from "./query-testing/test-runner";
133-
import type { TestManagerBase } from "./query-testing/test-manager-base";
134128
import { QueryRunner, QueryServerClient } from "./query-server";
135129
import { QueriesModule } from "./queries-panel/queries-module";
136130
import { OpenReferencedFileCodeLensProvider } from "./local-queries/open-referenced-file-code-lens-provider";
@@ -977,27 +971,8 @@ async function activateWithInstalledDistribution(
977971
const testRunner = new TestRunner(dbm, cliServer);
978972
ctx.subscriptions.push(testRunner);
979973

980-
let testManager: TestManagerBase | undefined = undefined;
981-
if (isCanary()) {
982-
testManager = new TestManager(app, testRunner, cliServer);
983-
ctx.subscriptions.push(testManager);
984-
} else {
985-
const testExplorerExtension = extensions.getExtension<TestHub>(
986-
testExplorerExtensionId,
987-
);
988-
if (testExplorerExtension) {
989-
const testHub = testExplorerExtension.exports;
990-
const testAdapterFactory = new QLTestAdapterFactory(
991-
testHub,
992-
testRunner,
993-
cliServer,
994-
);
995-
ctx.subscriptions.push(testAdapterFactory);
996-
997-
testManager = new TestUIService(app, testHub);
998-
ctx.subscriptions.push(testManager);
999-
}
1000-
}
974+
const testManager = new TestManager(app, testRunner, cliServer);
975+
ctx.subscriptions.push(testManager);
1001976

1002977
const testUiCommands = testManager?.getCommands() ?? {};
1003978

0 commit comments

Comments
 (0)