remove last untyped event from workbench

This commit is contained in:
Benjamin Pasero
2016-09-09 11:32:24 +02:00
parent 81ff3a94d5
commit 756ff78823
12 changed files with 103 additions and 83 deletions

View File

@@ -17,6 +17,7 @@ import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {IModeService} from 'vs/editor/common/services/modeService';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {IEventService} from 'vs/platform/event/common/event';
import Event, {Emitter} from 'vs/base/common/event';
import {ITextFileService} from 'vs/workbench/parts/files/common/files'; // TODO@Ben layer breaker
@@ -33,6 +34,8 @@ export class UntitledEditorInput extends AbstractUntitledEditorInput {
private modeId: string;
private cachedModel: UntitledEditorModel;
private _onDidModelChangeEncoding: Emitter<void>;
private toUnbind: IDisposable[];
constructor(
@@ -52,6 +55,11 @@ export class UntitledEditorInput extends AbstractUntitledEditorInput {
this.hasAssociatedFilePath = hasAssociatedFilePath;
this.modeId = modeId;
this.toUnbind = [];
this._onDidModelChangeEncoding = new Emitter<void>();
}
public get onDidModelChangeEncoding(): Event<void> {
return this._onDidModelChangeEncoding.event;
}
public getTypeId(): string {
@@ -153,8 +161,9 @@ export class UntitledEditorInput extends AbstractUntitledEditorInput {
const model = this.instantiationService.createInstance(UntitledEditorModel, content, mime || MIME_TEXT, this.resource, this.hasAssociatedFilePath);
// detect dirty state changes on model and re-emit
// re-emit some events from the model
this.toUnbind.push(model.onDidChangeDirty(() => this._onDidChangeDirty.fire()));
this.toUnbind.push(model.onDidChangeEncoding(() => this._onDidModelChangeEncoding.fire()));
return model;
}
@@ -175,6 +184,7 @@ export class UntitledEditorInput extends AbstractUntitledEditorInput {
}
public dispose(): void {
this._onDidModelChangeEncoding.dispose();
// Listeners
dispose(this.toUnbind);