mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
remove last untyped event from workbench
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user