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;