<commit_before>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import * as vscode from 'vscode';
import { TypeScriptVersion } from './versionProvider';
import * as languageModeIds from './languageModeIds';

export default class VersionStatus {
	private readonly onChangeEditorSub: vscode.Disposable;
	private readonly versionBarEntry: vscode.StatusBarItem;

	constructor(
		private readonly normalizePath: (resource: vscode.Uri) => string | null
	) {
		this.versionBarEntry = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 99 /* to the right of editor status (100) */);
		this.onChangeEditorSub = vscode.window.onDidChangeActiveTextEditor(this.showHideStatus, this);
	}

	dispose() {
		this.versionBarEntry.dispose();
		this.onChangeEditorSub.dispose();
	}

	public onDidChangeTypeScriptVersion(version: TypeScriptVersion) {
		this.showHideStatus();
		this.versionBarEntry.text = version.versionString;
		this.versionBarEntry.tooltip = version.path;
		this.versionBarEntry.command = 'typescript.selectTypeScriptVersion';
	}

	private showHideStatus() {
		if (!vscode.window.activeTextEditor) {
			this.versionBarEntry.hide();
			return;
		}

		const doc = vscode.window.activeTextEditor.document;
		if (vscode.languages.match([languageModeIds.typescript, languageModeIds.typescriptreact], doc)) {
			if (this.normalizePath(doc.uri)) {
				this.versionBarEntry.show();
			} else {
				this.versionBarEntry.hide();
			}
			return;
		}

		if (!vscode.window.activeTextEditor.viewColumn) {
			// viewColumn is undefined for the debug/output panel, but we still want
			// to show the version info in the existing editor
			return;
		}

		this.versionBarEntry.hide();
	}
}<commit_msg>Use _ prefix for private<commit_after>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import * as vscode from 'vscode';
import { TypeScriptVersion } from './versionProvider';
import * as languageModeIds from './languageModeIds';

export default class VersionStatus {
	private readonly _onChangeEditorSub: vscode.Disposable;
	private readonly _versionBarEntry: vscode.StatusBarItem;

	constructor(
		private readonly _normalizePath: (resource: vscode.Uri) => string | null
	) {
		this._versionBarEntry = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 99 /* to the right of editor status (100) */);
		this._onChangeEditorSub = vscode.window.onDidChangeActiveTextEditor(this.showHideStatus, this);
	}

	dispose() {
		this._versionBarEntry.dispose();
		this._onChangeEditorSub.dispose();
	}

	public onDidChangeTypeScriptVersion(version: TypeScriptVersion) {
		this.showHideStatus();
		this._versionBarEntry.text = version.versionString;
		this._versionBarEntry.tooltip = version.path;
		this._versionBarEntry.command = 'typescript.selectTypeScriptVersion';
	}

	private showHideStatus() {
		if (!vscode.window.activeTextEditor) {
			this._versionBarEntry.hide();
			return;
		}

		const doc = vscode.window.activeTextEditor.document;
		if (vscode.languages.match([languageModeIds.typescript, languageModeIds.typescriptreact], doc)) {
			if (this._normalizePath(doc.uri)) {
				this._versionBarEntry.show();
			} else {
				this._versionBarEntry.hide();
			}
			return;
		}

		if (!vscode.window.activeTextEditor.viewColumn) {
			// viewColumn is undefined for the debug/output panel, but we still want
			// to show the version info in the existing editor
			return;
		}

		this._versionBarEntry.hide();
	}
}
{'fraction_non_alphanumeric': 0.18889439762022806, 'fraction_numerical': 0.002478929102627665, 'mean_word_length': 2.9442815249266863, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7052001', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1103, 'n_words': 253}