提交 3c66a30b 编写于 作者: B Benjamin Pasero

💄

上级 8ec0c601
......@@ -194,7 +194,7 @@ export class UntitledEditorModel extends BaseTextEditorModel implements IEncodin
this.toDispose.push(this.textEditorModel.onDidChangeContent(() => this.onModelContentChanged()));
// Listen to mode changes
this.toDispose.push(this.textEditorModel.onDidChangeLanguage(() => this.onModelModeChanged()));
this.toDispose.push(this.textEditorModel.onDidChangeLanguage(() => this.onConfigurationChange())); // mode change can have impact on config
return model;
});
......@@ -234,10 +234,6 @@ export class UntitledEditorModel extends BaseTextEditorModel implements IEncodin
this.contentChangeEventScheduler.schedule();
}
private onModelModeChanged(): void {
this.onConfigurationChange(); // mode change can have impact on config
}
public dispose(): void {
super.dispose();
......
......@@ -120,16 +120,18 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
this.toDispose.push(this.fileService.onFileChanges(e => this.onFileChanges(e)));
this.toDispose.push(this.textFileService.onAutoSaveConfigurationChange(config => this.updateAutoSaveConfiguration(config)));
this.toDispose.push(this.textFileService.onFilesAssociationChange(e => this.onFilesAssociationChange()));
this.toDispose.push(this.onDidStateChange(e => {
if (e === StateChange.REVERTED) {
this.toDispose.push(this.onDidStateChange(e => this.onStateChange(e)));
}
// Cancel any content change event promises as they are no longer valid.
this.contentChangeEventScheduler.cancel();
private onStateChange(e: StateChange): void {
if (e === StateChange.REVERTED) {
// Refire state change reverted events as content change events
this._onDidContentChange.fire(StateChange.REVERTED);
}
}));
// Cancel any content change event promises as they are no longer valid.
this.contentChangeEventScheduler.cancel();
// Refire state change reverted events as content change events
this._onDidContentChange.fire(StateChange.REVERTED);
}
}
private onFileChanges(e: FileChangesEvent): void {
......@@ -450,10 +452,8 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
this.setDirty(false);
}
// See https://github.com/Microsoft/vscode/issues/30189
// This code has been extracted to a different method because it caused a memory leak
// where `value` was captured in the content change listener closure scope.
this._installChangeContentListener();
// Model Listeners
this.installModelListeners();
return this;
}, error => {
......@@ -466,13 +466,14 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
return this.createTextEditorModelPromise;
}
private _installChangeContentListener(): void {
private installModelListeners(): void {
// See https://github.com/Microsoft/vscode/issues/30189
// This code has been extracted to a different method because it caused a memory leak
// where `value` was captured in the content change listener closure scope.
this.toDispose.push(this.textEditorModel.onDidChangeContent(() => {
this.onModelContentChanged();
}));
// Content Change
this.toDispose.push(this.textEditorModel.onDidChangeContent(() => this.onModelContentChanged()));
}
private doLoadBackup(backup: URI): TPromise<string> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册