Remove UIService

This class seems to have been introduced at some point to reduce the
dependency on VS Code from the test UI service. However, none of its
methods are being used anymore, and by using typed commands we have
already reduced the dependency on VS Code. Therefore, we can simply
remove this class.
This commit is contained in:
Koen Vlaswinkel
2023-03-22 15:14:22 +01:00
parent 9f85f56055
commit e74a2e4a15
2 changed files with 1 additions and 34 deletions

View File

@@ -14,7 +14,6 @@ import {
import { showAndLogWarningMessage } from "./helpers"; import { showAndLogWarningMessage } from "./helpers";
import { TestTreeNode } from "./test-tree-node"; import { TestTreeNode } from "./test-tree-node";
import { DisposableObject } from "./pure/disposable-object"; import { DisposableObject } from "./pure/disposable-object";
import { UIService } from "./vscode-utils/ui-service";
import { QLTestAdapter, getExpectedFile, getActualFile } from "./test-adapter"; import { QLTestAdapter, getExpectedFile, getActualFile } from "./test-adapter";
import { TestUICommands } from "./common/commands"; import { TestUICommands } from "./common/commands";
@@ -42,7 +41,7 @@ class QLTestListener extends DisposableObject {
/** /**
* Service that implements all UI and commands for QL tests. * Service that implements all UI and commands for QL tests.
*/ */
export class TestUIService extends UIService implements TestController { export class TestUIService extends DisposableObject implements TestController {
private readonly listeners: Map<TestAdapter, QLTestListener> = new Map(); private readonly listeners: Map<TestAdapter, QLTestListener> = new Map();
constructor(private readonly testHub: TestHub) { constructor(private readonly testHub: TestHub) {

View File

@@ -1,32 +0,0 @@
import { TreeDataProvider, window } from "vscode";
import { DisposableObject } from "../pure/disposable-object";
import { commandRunner } from "../commandRunner";
/**
* A VS Code service that interacts with the UI, including handling commands.
*/
export class UIService extends DisposableObject {
protected constructor() {
super();
}
/**
* Registers a command handler with Visual Studio Code.
* @param command The ID of the command to register.
* @param callback Callback function to implement the command.
* @remarks The command handler is automatically unregistered when the service is disposed.
*/
protected registerCommand(
command: string,
callback: (...args: any[]) => any,
): void {
this.push(commandRunner(command, callback.bind(this)));
}
protected registerTreeDataProvider<T>(
viewId: string,
treeDataProvider: TreeDataProvider<T>,
): void {
this.push(window.registerTreeDataProvider<T>(viewId, treeDataProvider));
}
}