mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 19:44:25 +01:00
Add an untitled document data property (#115790)
* Add an untitled document data property * Dispose of the model passed back * Fix layer problem * Add untitledDocumentData to untitled notebooks * Fix compilation errors * Switch to using VS Buffer * Fix threading the untitled document data back through * Prevent save dialog on untitled reopen with * Change ignore save setting * Change setting name and abide by preserve focus * Add unit test * Switch to js doc comments * Consolidate calculating the untitled value, and added test
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
import { multibyteAwareBtoa } from 'vs/base/browser/dom';
|
||||
import { CancelablePromise, createCancelablePromise, timeout } from 'vs/base/common/async';
|
||||
import { VSBuffer } from 'vs/base/common/buffer';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { isPromiseCanceledError, onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
@@ -303,8 +304,13 @@ class MainThreadCustomEditorModel extends Disposable implements ICustomEditorMod
|
||||
getEditors: () => CustomEditorInput[],
|
||||
cancellation: CancellationToken,
|
||||
_backupFileService: IBackupFileService,
|
||||
) {
|
||||
const { editable } = await proxy.$createCustomDocument(resource, viewType, options.backupId, cancellation);
|
||||
): Promise<MainThreadCustomEditorModel> {
|
||||
const editors = getEditors();
|
||||
let untitledDocumentData: VSBuffer | undefined;
|
||||
if (editors.length !== 0) {
|
||||
untitledDocumentData = editors[0].untitledDocumentData;
|
||||
}
|
||||
const { editable } = await proxy.$createCustomDocument(resource, viewType, options.backupId, untitledDocumentData, cancellation);
|
||||
return instantiationService.createInstance(MainThreadCustomEditorModel, proxy, viewType, resource, !!options.backupId, editable, getEditors);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user