move notebook save event into notebook editor model service, remove resolve/save/backup from notebook service and let editor model use content provider directly

This commit is contained in:
Johannes Rieken
2021-03-19 13:13:40 +01:00
parent a27b6f7449
commit 7d99c47b75
10 changed files with 61 additions and 78 deletions

View File

@@ -125,7 +125,7 @@ export class MainThreadNotebooks implements MainThreadNotebookShape {
@IEditorService private readonly _editorService: IEditorService,
@ILogService private readonly _logService: ILogService,
@INotebookCellStatusBarService private readonly _cellStatusBarService: INotebookCellStatusBarService,
@INotebookEditorModelResolverService private readonly _notebookModelResolverService: INotebookEditorModelResolverService,
@INotebookEditorModelResolverService private readonly _notebookEditorModelResolverService: INotebookEditorModelResolverService,
@IUriIdentityService private readonly _uriIdentityService: IUriIdentityService
) {
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostNotebook);
@@ -325,7 +325,7 @@ export class MainThreadNotebooks implements MainThreadNotebookShape {
this._proxy.$acceptNotebookActiveKernelChange(e);
}));
this._disposables.add(this._notebookService.onNotebookDocumentSaved(e => {
this._disposables.add(this._notebookEditorModelResolverService.onDidSaveNotebook(e => {
this._proxy.$acceptModelSaved(e);
}));
@@ -405,8 +405,8 @@ export class MainThreadNotebooks implements MainThreadNotebookShape {
contentOptions.transientOutputs = newOptions.transientOutputs;
},
viewOptions: options.viewOptions,
openNotebook: async (viewType: string, uri: URI, backupId: string | undefined, token: CancellationToken, untitledDocumentData?: VSBuffer) => {
const data = await this._proxy.$openNotebook(viewType, uri, backupId, token, untitledDocumentData);
open: async (uri: URI, backupId: string | undefined, untitledDocumentData: VSBuffer | undefined, token: CancellationToken) => {
const data = await this._proxy.$openNotebook(viewType, uri, backupId, untitledDocumentData, token);
return {
data,
transientOptions: contentOptions
@@ -605,7 +605,7 @@ export class MainThreadNotebooks implements MainThreadNotebookShape {
async $tryOpenDocument(uriComponents: UriComponents): Promise<URI> {
const uri = URI.revive(uriComponents);
const ref = await this._notebookModelResolverService.resolve(uri, undefined);
const ref = await this._notebookEditorModelResolverService.resolve(uri, undefined);
this._modelReferenceCollection.add(uri, ref);
return uri;
}
@@ -613,7 +613,7 @@ export class MainThreadNotebooks implements MainThreadNotebookShape {
async $trySaveDocument(uriComponents: UriComponents) {
const uri = URI.revive(uriComponents);
const ref = await this._notebookModelResolverService.resolve(uri);
const ref = await this._notebookEditorModelResolverService.resolve(uri);
const saveResult = await ref.object.save();
ref.dispose();
return saveResult;