提交 f461eb59 编写于 作者: J Johannes Rieken

Merge pull request #4515 from Microsoft/joh/fixLargeModelIssues

checks models when file events happen
......@@ -494,13 +494,19 @@ export class MainThreadDocuments {
modelService.onModelModeChanged(this._onModelModeChanged, this, this._toDispose);
this._toDispose.push(eventService.addListener2(FileEventType.FILE_SAVED, (e: LocalFileChangeEvent) => {
if (this._shouldHandleFileEvent(e)) {
this._proxy._acceptModelSaved(e.getAfter().resource.toString());
}
}));
this._toDispose.push(eventService.addListener2(FileEventType.FILE_REVERTED, (e: LocalFileChangeEvent) => {
if (this._shouldHandleFileEvent(e)) {
this._proxy._acceptModelReverted(e.getAfter().resource.toString());
}
}));
this._toDispose.push(eventService.addListener2(FileEventType.FILE_DIRTY, (e: LocalFileChangeEvent) => {
if (this._shouldHandleFileEvent(e)) {
this._proxy._acceptModelDirty(e.getAfter().resource.toString());
}
}));
const handle = setInterval(() => this._runDocumentCleanup(), 30 * 1000);
......@@ -519,6 +525,12 @@ export class MainThreadDocuments {
this._toDispose = disposeAll(this._toDispose);
}
private _shouldHandleFileEvent(e: LocalFileChangeEvent): boolean {
const after = e.getAfter();
const model = this._modelService.getModel(after.resource);
return model && !model.isTooLargeForHavingARichMode();
}
private _onModelAdded(model: EditorCommon.IModel): void {
// Same filter as in mainThreadEditors
if (model.isTooLargeForHavingARichMode()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册