From 65edfbaca0fa5569c73d9e753f0e545d29220b3f Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 19 Sep 2023 21:03:02 +0200 Subject: [PATCH] editors - check model for being too large (#193427) (#193510) --- src/vs/workbench/browser/dnd.ts | 4 ++-- .../contrib/files/browser/editors/fileEditorInput.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/browser/dnd.ts b/src/vs/workbench/browser/dnd.ts index 52afb8083d8..03550d2d646 100644 --- a/src/vs/workbench/browser/dnd.ts +++ b/src/vs/workbench/browser/dnd.ts @@ -294,8 +294,8 @@ export function fillEditorsDragData(accessor: ServicesAccessor, resourcesOrEdito editor.encoding = textFileModel.getEncoding(); } - // contents (only if dirty) - if (typeof editor.contents !== 'string' && textFileModel.isDirty()) { + // contents (only if dirty and not too large) + if (typeof editor.contents !== 'string' && textFileModel.isDirty() && !textFileModel.textEditorModel.isTooLargeForHeapOperation()) { editor.contents = textFileModel.textEditorModel.getValue(); } } diff --git a/src/vs/workbench/contrib/files/browser/editors/fileEditorInput.ts b/src/vs/workbench/contrib/files/browser/editors/fileEditorInput.ts index faf84eafbf9..d6c151043f0 100644 --- a/src/vs/workbench/contrib/files/browser/editors/fileEditorInput.ts +++ b/src/vs/workbench/contrib/files/browser/editors/fileEditorInput.ts @@ -433,8 +433,8 @@ export class FileEditorInput extends AbstractTextResourceEditorInput implements untypedInput.languageId = this.getLanguageId(); untypedInput.contents = (() => { const model = this.textFileService.files.get(this.resource); - if (model?.isDirty()) { - return model.textEditorModel.getValue(); // only if dirty + if (model?.isDirty() && !model.textEditorModel.isTooLargeForHeapOperation()) { + return model.textEditorModel.getValue(); // only if dirty and not too large } return undefined;