@@ -11,9 +11,9 @@ import { joinPath } from 'vs/base/common/resources';
11
11
import { ISplice } from 'vs/base/common/sequence' ;
12
12
import { URI } from 'vs/base/common/uri' ;
13
13
import * as UUID from 'vs/base/common/uuid' ;
14
- import { CellKind , MainThreadNotebookShape , NotebookCellOutputsSplice } from 'vs/workbench/api/common/extHost.protocol' ;
14
+ import { CellKind , IWorkspaceCellEditDto , MainThreadBulkEditsShape , MainThreadNotebookShape , NotebookCellOutputsSplice , WorkspaceEditType } from 'vs/workbench/api/common/extHost.protocol' ;
15
15
import { ExtHostDocumentsAndEditors , IExtHostModelAddedData } from 'vs/workbench/api/common/extHostDocumentsAndEditors' ;
16
- import { CellOutputKind , diff , IMainCellDto , IProcessedOutput , NotebookCellMetadata , NotebookCellsChangedEventDto , NotebookCellsChangeType , NotebookCellsSplice2 , notebookDocumentMetadataDefaults } from 'vs/workbench/contrib/notebook/common/notebookCommon' ;
16
+ import { CellEditType , CellOutputKind , diff , IMainCellDto , IProcessedOutput , NotebookCellMetadata , NotebookCellsChangedEventDto , NotebookCellsChangeType , NotebookCellsSplice2 , notebookDocumentMetadataDefaults } from 'vs/workbench/contrib/notebook/common/notebookCommon' ;
17
17
import * as vscode from 'vscode' ;
18
18
import { Cache } from './cache' ;
19
19
@@ -86,7 +86,7 @@ export class ExtHostCell extends Disposable {
86
86
private _cell : vscode . NotebookCell | undefined ;
87
87
88
88
constructor (
89
- private readonly _proxy : MainThreadNotebookShape ,
89
+ private readonly _mainThreadBulkEdits : MainThreadBulkEditsShape ,
90
90
private readonly _notebook : ExtHostNotebookDocument ,
91
91
private readonly _extHostDocument : ExtHostDocumentsAndEditors ,
92
92
private readonly _cellData : IMainCellDto ,
@@ -181,8 +181,18 @@ export class ExtHostCell extends Disposable {
181
181
} ) ) ;
182
182
}
183
183
184
- private _updateMetadata ( ) : Promise < void > {
185
- return this . _proxy . $updateNotebookCellMetadata ( this . _notebook . notebookDocument . viewType , this . _notebook . uri , this . handle , this . _metadata ) ;
184
+ private _updateMetadata ( ) : Promise < boolean > {
185
+ const index = this . _notebook . notebookDocument . cells . indexOf ( this . cell ) ;
186
+ const edit : IWorkspaceCellEditDto = {
187
+ _type : WorkspaceEditType . Cell ,
188
+ metadata : undefined ,
189
+ resource : this . _notebook . uri ,
190
+ notebookVersionId : this . _notebook . notebookDocument . version ,
191
+ edit : { editType : CellEditType . Metadata , index, metadata : this . _metadata }
192
+ } ;
193
+
194
+ console . log ( '_updateMetadata' , this . _metadata ) ;
195
+ return this . _mainThreadBulkEdits . $tryApplyWorkspaceEdit ( { edits : [ edit ] } ) ;
186
196
}
187
197
}
188
198
@@ -222,6 +232,7 @@ export class ExtHostNotebookDocument extends Disposable {
222
232
constructor (
223
233
private readonly _proxy : MainThreadNotebookShape ,
224
234
private readonly _documentsAndEditors : ExtHostDocumentsAndEditors ,
235
+ private readonly _mainThreadBulkEdits : MainThreadBulkEditsShape ,
225
236
private readonly _emitter : INotebookEventEmitter ,
226
237
private readonly _viewType : string ,
227
238
metadata : Required < vscode . NotebookDocumentMetadata > ,
@@ -339,7 +350,7 @@ export class ExtHostNotebookDocument extends Disposable {
339
350
const cellDtos = splice [ 2 ] ;
340
351
const newCells = cellDtos . map ( cell => {
341
352
342
- const extCell = new ExtHostCell ( this . _proxy , this , this . _documentsAndEditors , cell ) ;
353
+ const extCell = new ExtHostCell ( this . _mainThreadBulkEdits , this , this . _documentsAndEditors , cell ) ;
343
354
344
355
if ( ! initialization ) {
345
356
addedCellDocuments . push ( ExtHostCell . asModelAddData ( this . notebookDocument , cell ) ) ;
0 commit comments