Convert extensions/ql-vscode/src/test-ui.ts to call typed commands
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { CommandManager } from "../packages/commands";
|
||||
import type { Uri, Range } from "vscode";
|
||||
import type { Uri, Range, TextDocumentShowOptions } from "vscode";
|
||||
import type { AstItem } from "../astViewer";
|
||||
import type { DbTreeViewItem } from "../databases/ui/db-tree-view-item";
|
||||
import type { DatabaseItem } from "../local-databases";
|
||||
@@ -42,6 +42,12 @@ export type BuiltInVsCodeCommands = {
|
||||
value: unknown,
|
||||
) => Promise<void>;
|
||||
"workbench.action.reloadWindow": () => Promise<void>;
|
||||
"vscode.diff": (
|
||||
leftSideResource: Uri,
|
||||
rightSideResource: Uri,
|
||||
title?: string,
|
||||
columnOrOptions?: TextDocumentShowOptions,
|
||||
) => Promise<void>;
|
||||
"vscode.openFolder": (uri: Uri) => Promise<void>;
|
||||
};
|
||||
|
||||
|
||||
@@ -851,7 +851,7 @@ async function activateWithInstalledDistribution(
|
||||
);
|
||||
ctx.subscriptions.push(testAdapterFactory);
|
||||
|
||||
const testUIService = new TestUIService(testHub);
|
||||
const testUIService = new TestUIService(app, testHub);
|
||||
ctx.subscriptions.push(testUIService);
|
||||
|
||||
testUiCommands = testUIService.getCommands();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { lstat, copy, pathExists, createFile } from "fs-extra";
|
||||
import { basename } from "path";
|
||||
import { Uri, TextDocumentShowOptions, commands, window } from "vscode";
|
||||
import { Uri, TextDocumentShowOptions, window } from "vscode";
|
||||
import {
|
||||
TestHub,
|
||||
TestController,
|
||||
@@ -16,6 +16,7 @@ import { TestTreeNode } from "./test-tree-node";
|
||||
import { DisposableObject } from "./pure/disposable-object";
|
||||
import { QLTestAdapter, getExpectedFile, getActualFile } from "./test-adapter";
|
||||
import { TestUICommands } from "./common/commands";
|
||||
import { App } from "./common/app";
|
||||
|
||||
type VSCodeTestEvent =
|
||||
| TestRunStartedEvent
|
||||
@@ -44,7 +45,7 @@ class QLTestListener extends DisposableObject {
|
||||
export class TestUIService extends DisposableObject implements TestController {
|
||||
private readonly listeners: Map<TestAdapter, QLTestListener> = new Map();
|
||||
|
||||
constructor(private readonly testHub: TestHub) {
|
||||
constructor(private readonly app: App, private readonly testHub: TestHub) {
|
||||
super();
|
||||
|
||||
testHub.registerTestController(this);
|
||||
@@ -105,7 +106,7 @@ export class TestUIService extends DisposableObject implements TestController {
|
||||
|
||||
if (await pathExists(actualPath)) {
|
||||
const actualUri = Uri.file(actualPath);
|
||||
await commands.executeCommand<void>(
|
||||
await this.app.commands.execute(
|
||||
"vscode.diff",
|
||||
expectedUri,
|
||||
actualUri,
|
||||
|
||||
Reference in New Issue
Block a user