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

'use strict';

import { dispose, Disposable, IDisposable, empty as EmptyDisposable } from 'vs/base/common/lifecycle';
import { EditorInput, EditorOptions } from 'vs/workbench/common/editor';
import { Dimension, show, hide, addClass } from 'vs/base/browser/dom';
import { Registry } from 'vs/platform/registry/common/platform';
import { IEditorRegistry, Extensions as EditorExtensions, IEditorDescriptor } from 'vs/workbench/browser/editor';
import { TPromise } from 'vs/base/common/winjs.base';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IProgressService, LongRunningOperation } from 'vs/platform/progress/common/progress';
import { toWinJsPromise } from 'vs/base/common/async';
import { IEditorGroupView } from 'vs/workbench/browser/parts/editor/editor';
import { Event, Emitter } from 'vs/base/common/event';

export interface IOpenEditorResult {
	readonly control: BaseEditor;
	readonly editorChanged: boolean;
}

export class EditorControl extends Disposable {

	private _onDidFocus: Emitter<void> = this._register(new Emitter<void>());
	get onDidFocus(): Event<void> { return this._onDidFocus.event; }

	private activeControlFocusListener: IDisposable;

	private dimension: Dimension;
	private editorOperation: LongRunningOperation;

	get minimumWidth(): number { return this._activeControl ? this._activeControl.minimumWidth : 0; }
	get minimumHeight(): number { return this._activeControl ? this._activeControl.minimumHeight : 0; }
	get maximumWidth(): number { return this._activeControl ? this._activeControl.maximumWidth : Number.POSITIVE_INFINITY; }
	get maximumHeight(): number { return this._activeControl ? this._activeControl.maximumHeight : Number.POSITIVE_INFINITY; }

	private _onDidChange = new Emitter<{ width: number; height: number; }>();
	readonly onDidChange: Event<{ width: number; height: number; }> = this._onDidChange.event;

	private _activeControl: BaseEditor;
	private activeControlDisposable: IDisposable = EmptyDisposable;
	private controls: BaseEditor[] = [];

	constructor(
		private parent: HTMLElement,
		private groupView: IEditorGroupView,
		@IPartService private partService: IPartService,
		@IInstantiationService private instantiationService: IInstantiationService,
		@IProgressService progressService: IProgressService
	) {
		super();

		this.editorOperation = this._register(new LongRunningOperation(progressService));
	}

	private setActiveControl(activeControl: BaseEditor) {
		this.activeControlDisposable.dispose();
		this._activeControl = activeControl;

		if (activeControl) {
			this.activeControlDisposable = activeControl.onDidChange(e => this._onDidChange.fire(e));
		}
<commit_msg>empty editor controls should still have minimum width & height<commit_after>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

'use strict';

import { dispose, Disposable, IDisposable, empty as EmptyDisposable } from 'vs/base/common/lifecycle';
import { EditorInput, EditorOptions } from 'vs/workbench/common/editor';
import { Dimension, show, hide, addClass } from 'vs/base/browser/dom';
import { Registry } from 'vs/platform/registry/common/platform';
import { IEditorRegistry, Extensions as EditorExtensions, IEditorDescriptor } from 'vs/workbench/browser/editor';
import { TPromise } from 'vs/base/common/winjs.base';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IProgressService, LongRunningOperation } from 'vs/platform/progress/common/progress';
import { toWinJsPromise } from 'vs/base/common/async';
import { IEditorGroupView, DEFAULT_EDITOR_MIN_DIMENSIONS, DEFAULT_EDITOR_MAX_DIMENSIONS } from 'vs/workbench/browser/parts/editor/editor';
import { Event, Emitter } from 'vs/base/common/event';

export interface IOpenEditorResult {
	readonly control: BaseEditor;
	readonly editorChanged: boolean;
}

export class EditorControl extends Disposable {

	private _onDidFocus: Emitter<void> = this._register(new Emitter<void>());
	get onDidFocus(): Event<void> { return this._onDidFocus.event; }

	private activeControlFocusListener: IDisposable;

	private dimension: Dimension;
	private editorOperation: LongRunningOperation;

	get minimumWidth(): number { return this._activeControl ? this._activeControl.minimumWidth : DEFAULT_EDITOR_MIN_DIMENSIONS.width; }
	get minimumHeight(): number { return this._activeControl ? this._activeControl.minimumHeight : DEFAULT_EDITOR_MIN_DIMENSIONS.height; }
	get maximumWidth(): number { return this._activeControl ? this._activeControl.maximumWidth : DEFAULT_EDITOR_MAX_DIMENSIONS.width; }
	get maximumHeight(): number { return this._activeControl ? this._activeControl.maximumHeight : DEFAULT_EDITOR_MAX_DIMENSIONS.height; }

	private _onDidChange = new Emitter<{ width: number; height: number; }>();
	readonly onDidChange: Event<{ width: number; height: number; }> = this._onDidChange.event;

	private _activeControl: BaseEditor;
	private activeControlDisposable: IDisposable = EmptyDisposable;
	private controls: BaseEditor[] = [];

	constructor(
		private parent: HTMLElement,
		private groupView: IEditorGroupView,
		@IPartService private partService: IPartService,
		@IInstantiationService private instantiationService: IInstantiationService,
		@IProgressService progressService: IProgressService
	) {
		super();

		this.editorOperation = this._register(new LongRunningOperation(progressService));
	}

	private setActiveControl(activeControl: BaseEditor) {
		this.activeControlDisposable.dispose();
		this._activeControl = activeControl;

		if (activeControl) {
			this.activeControlDisposable = activeControl.onDidChange(e => this._onDidChange.fire(e));
		}

{'fraction_non_alphanumeric': 0.15260377358490565, 'fraction_numerical': 0.0003018867924528302, 'mean_word_length': 4.352180936995153, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '4819669', 'n_tokens_mistral': 1844, 'n_tokens_neox': 1739, 'n_words': 432}