editors - check model for being too large (#193427) (#193510)

This commit is contained in:
Benjamin Pasero 2023-09-19 21:03:02 +02:00 committed by GitHub
parent 3e31b71648
commit 65edfbaca0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -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();
}
}

View file

@ -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;