<commit_before>import { StatusBarItem, window, workspace, OutputChannel, StatusBarAlignment } from 'vscode';

import { TestRunner } from './TestRunner';
import { constants } from './constants';

let instance: NodeTDD;

export class NodeTDD {
    private enabled = false;
    private outputShown = false;
    private extensionStatusBar: StatusBarItem;
    private buildStatusBar: StatusBarItem;
    private outputChannel: OutputChannel;
    private testRunner: TestRunner;

    static getInstance() {
        if (!instance) {
            instance = new NodeTDD();
        }

        return instance;
    }

    static getConfig() {
        return workspace.getConfiguration(constants.CONFIG_SECTION_KEY);
    }

    private constructor() {
        this.outputChannel = window.createOutputChannel(constants.OUTPUT_CHANNEL_NAME);
        this.testRunner = new TestRunner();

        this.extensionStatusBar = window.createStatusBarItem(StatusBarAlignment.Left, 2);
        this.buildStatusBar = window.createStatusBarItem(StatusBarAlignment.Left, 1);
        this.buildStatusBar.command = constants.SHOW_OUTPUT_COMMAND;

        this.activate();

        this.extensionStatusBar.show();
    }

    activate() {
        if (this.enabled) {
            return;
        }

        this.enabled = true;
        this.showBuildStatusBar();
        Object.assign(this.extensionStatusBar, constants.ACTIVATE_EXTENSION);
        this.testRunner.watch();
    }

    deactivate() {
        if (!this.enabled) {
            return;
        }

        this.enabled = false;
        this.hideBuildStatusBar();
        Object.assign(this.extensionStatusBar, constants.DEACTIVATE_EXTENSION);
        this.testRunner.dispose();
    }

    setBuildStatusBar(obj: any) {
        Object.assign(this.buildStatusBar, obj);
    }

    showBuildStatusBar() {
        this.buildStatusBar.show();
    }

    hideBuildStatusBar() {
        this.buildStatusBar.hide();
    }

    clearOutput() {
        this.outputChannel.clear();
    }

    hideOutput() {
        this.outputChannel.hide();
        this.outputShown = false;
    }

    toggleOutput() {
        if (this.outputShown) {
            this.outputChannel.hide();
        }
        else {
            this.outputChannel.show();
        }

        this.outputShown = !this.outputShown;
    }

    setOutput(text: string) {
        this.outputChannel.append(text);
    }

    dispose() {
        this.extensionStatusBar.dispose();
        this.buildStatusBar.dispose();
        this.outputChannel.dispose();
        this.testRunner.dispose();
    }

    noop() { }
}<commit_msg>Remove noop<commit_after>import { StatusBarItem, window, workspace, OutputChannel, StatusBarAlignment } from 'vscode';

import { TestRunner } from './TestRunner';
import { constants } from './constants';

let instance: NodeTDD;

export class NodeTDD {
    private enabled = false;
    private outputShown = false;
    private extensionStatusBar: StatusBarItem;
    private buildStatusBar: StatusBarItem;
    private outputChannel: OutputChannel;
    private testRunner: TestRunner;

    static getInstance() {
        if (!instance) {
            instance = new NodeTDD();
        }

        return instance;
    }

    static getConfig() {
        return workspace.getConfiguration(constants.CONFIG_SECTION_KEY);
    }

    private constructor() {
        this.outputChannel = window.createOutputChannel(constants.OUTPUT_CHANNEL_NAME);
        this.testRunner = new TestRunner();

        this.extensionStatusBar = window.createStatusBarItem(StatusBarAlignment.Left, 2);
        this.buildStatusBar = window.createStatusBarItem(StatusBarAlignment.Left, 1);
        this.buildStatusBar.command = constants.SHOW_OUTPUT_COMMAND;

        this.activate();

        this.extensionStatusBar.show();
    }

    activate() {
        if (this.enabled) {
            return;
        }

        this.enabled = true;
        this.showBuildStatusBar();
        Object.assign(this.extensionStatusBar, constants.ACTIVATE_EXTENSION);
        this.testRunner.watch();
    }

    deactivate() {
        if (!this.enabled) {
            return;
        }

        this.enabled = false;
        this.hideBuildStatusBar();
        Object.assign(this.extensionStatusBar, constants.DEACTIVATE_EXTENSION);
        this.testRunner.dispose();
    }

    setBuildStatusBar(obj: any) {
        Object.assign(this.buildStatusBar, obj);
    }

    showBuildStatusBar() {
        this.buildStatusBar.show();
    }

    hideBuildStatusBar() {
        this.buildStatusBar.hide();
    }

    clearOutput() {
        this.outputChannel.clear();
    }

    hideOutput() {
        this.outputChannel.hide();
        this.outputShown = false;
    }

    toggleOutput() {
        if (this.outputShown) {
            this.outputChannel.hide();
        }
        else {
            this.outputChannel.show();
        }

        this.outputShown = !this.outputShown;
    }

    setOutput(text: string) {
        this.outputChannel.append(text);
    }

    dispose() {
        this.extensionStatusBar.dispose();
        this.buildStatusBar.dispose();
        this.outputChannel.dispose();
        this.testRunner.dispose();
    }
}
{'fraction_non_alphanumeric': 0.10854503464203233, 'fraction_numerical': 0.0007698229407236335, 'mean_word_length': 2.379063719115735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7507276', 'n_tokens_mistral': 1479, 'n_tokens_neox': 1435, 'n_words': 242}