Skip to content

Commit

Permalink
Merge pull request #3232 from github/dbartol/new-test-api
Browse files Browse the repository at this point in the history
Switch to built-in VS Code test UI unconditionally
  • Loading branch information
dbartol authored Jan 11, 2024
2 parents c065c44 + 4b3a008 commit b67efee
Show file tree
Hide file tree
Showing 14 changed files with 107 additions and 571 deletions.
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ To see what has changed in the last few versions of the extension, see the [Chan

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

## Dependencies

This extension depends on the following two extensions for required functionality. They will be installed automatically when you install VS Code CodeQL.

- [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)

## Contributing

This project welcomes contributions. See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to build, install, and contribute.
Expand Down
3 changes: 3 additions & 0 deletions extensions/ql-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## [UNRELEASED]

- 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)
- 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.
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
not being used by any other extensions you may have installed.

## 1.12.0 - 11 January 2024

Expand Down
2 changes: 0 additions & 2 deletions extensions/ql-vscode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ For information about other configurations, see the separate [CodeQL help](https
### Quick start: Installing and configuring the extension

1. [Install the extension](#installing-the-extension).
*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).*

1. [Check access to the CodeQL CLI](#checking-access-to-the-codeql-cli).
1. [Clone the CodeQL starter workspace](#cloning-the-codeql-starter-workspace).

Expand Down
27 changes: 0 additions & 27 deletions extensions/ql-vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions extensions/ql-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"Programming Languages"
],
"extensionDependencies": [
"hbenl.vscode-test-explorer",
"vscode.git"
],
"capabilities": {
Expand Down Expand Up @@ -1938,8 +1937,6 @@
"vscode-extension-telemetry": "^0.1.6",
"vscode-jsonrpc": "^8.0.2",
"vscode-languageclient": "^8.0.2",
"vscode-test-adapter-api": "^1.7.0",
"vscode-test-adapter-util": "^0.7.0",
"yauzl": "^2.10.0",
"zip-a-folder": "^3.1.3"
},
Expand Down
11 changes: 4 additions & 7 deletions extensions/ql-vscode/src/common/commands.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type { CommandManager } from "../packages/commands";
import type { Uri, Range, TextDocumentShowOptions } from "vscode";
import type { Uri, Range, TextDocumentShowOptions, TestItem } from "vscode";
import type { AstItem } from "../language-support";
import type { DbTreeViewItem } from "../databases/ui/db-tree-view-item";
import type { DatabaseItem } from "../databases/local-databases";
import type { QueryHistoryInfo } from "../query-history/query-history-info";
import type { TestTreeNode } from "../query-testing/test-tree-node";
import type {
VariantAnalysis,
VariantAnalysisScannedRepository,
Expand Down Expand Up @@ -334,11 +333,9 @@ export type SummaryLanguageSupportCommands = {
};

export type TestUICommands = {
"codeQLTests.showOutputDifferences": (node: TestTreeNode) => Promise<void>;
"codeQLTests.acceptOutput": (node: TestTreeNode) => Promise<void>;
"codeQLTests.acceptOutputContextTestItem": (
node: TestTreeNode,
) => Promise<void>;
"codeQLTests.showOutputDifferences": (node: TestItem) => Promise<void>;
"codeQLTests.acceptOutput": (node: TestItem) => Promise<void>;
"codeQLTests.acceptOutputContextTestItem": (node: TestItem) => Promise<void>;
};

export type MockGitHubApiServerCommands = {
Expand Down
29 changes: 2 additions & 27 deletions extensions/ql-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import { arch, homedir, platform } from "os";
import { ensureDir } from "fs-extra";
import { join } from "path";
import { dirSync } from "tmp-promise";
import type { TestHub } from "vscode-test-adapter-api";
import { testExplorerExtensionId } from "vscode-test-adapter-api";
import { lt, parse } from "semver";
import { watch } from "chokidar";
import {
Expand All @@ -28,7 +26,6 @@ import {
CliConfigListener,
DistributionConfigListener,
GitHubDatabaseConfigListener,
isCanary,
joinOrderWarningThreshold,
QueryHistoryConfigListener,
QueryServerConfigListener,
Expand Down Expand Up @@ -90,8 +87,6 @@ import {
} from "./common/logging/vscode";
import { QueryHistoryManager } from "./query-history/query-history-manager";
import type { CompletedLocalQueryInfo } from "./query-results";
import { QLTestAdapterFactory } from "./query-testing/test-adapter";
import { TestUIService } from "./query-testing/test-ui";
import { CompareView } from "./compare/compare-view";
import {
initializeTelemetry,
Expand Down Expand Up @@ -130,7 +125,6 @@ import { DebuggerUI } from "./debugger/debugger-ui";
import { ModelEditorModule } from "./model-editor/model-editor-module";
import { TestManager } from "./query-testing/test-manager";
import { TestRunner } from "./query-testing/test-runner";
import type { TestManagerBase } from "./query-testing/test-manager-base";
import { QueryRunner, QueryServerClient } from "./query-server";
import { QueriesModule } from "./queries-panel/queries-module";
import { OpenReferencedFileCodeLensProvider } from "./local-queries/open-referenced-file-code-lens-provider";
Expand Down Expand Up @@ -977,27 +971,8 @@ async function activateWithInstalledDistribution(
const testRunner = new TestRunner(dbm, cliServer);
ctx.subscriptions.push(testRunner);

let testManager: TestManagerBase | undefined = undefined;
if (isCanary()) {
testManager = new TestManager(app, testRunner, cliServer);
ctx.subscriptions.push(testManager);
} else {
const testExplorerExtension = extensions.getExtension<TestHub>(
testExplorerExtensionId,
);
if (testExplorerExtension) {
const testHub = testExplorerExtension.exports;
const testAdapterFactory = new QLTestAdapterFactory(
testHub,
testRunner,
cliServer,
);
ctx.subscriptions.push(testAdapterFactory);

testManager = new TestUIService(app, testHub);
ctx.subscriptions.push(testManager);
}
}
const testManager = new TestManager(app, testRunner, cliServer);
ctx.subscriptions.push(testManager);

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

Expand Down
Loading

0 comments on commit b67efee

Please sign in to comment.