@@ -212,13 +212,13 @@ export class RNotebookProvider implements vscode.NotebookContentProvider, vscode
212212 }
213213
214214 return {
215- languages : [ 'r' , 'yaml' ] ,
215+ languages : [ 'r' ] ,
216216 metadata : { } ,
217217 cells : cells ,
218218 } ;
219219 }
220220
221- async save ( targetResource : vscode . Uri , document : vscode . NotebookDocument , cancellation : vscode . CancellationToken ) : Promise < void > {
221+ async save ( document : vscode . NotebookDocument , targetResource : vscode . Uri , cancellation : vscode . CancellationToken ) : Promise < void > {
222222 let content = '' ;
223223 for ( const cell of document . cells ) {
224224 if ( cancellation . isCancellationRequested ) {
@@ -236,20 +236,29 @@ export class RNotebookProvider implements vscode.NotebookContentProvider, vscode
236236 }
237237 }
238238 }
239- await vscode . workspace . fs . writeFile ( document . uri , Buffer . from ( content ) ) ;
239+ await vscode . workspace . fs . writeFile ( targetResource , Buffer . from ( content ) ) ;
240240 }
241241
242242 onDidChangeNotebook = new vscode . EventEmitter < vscode . NotebookDocumentEditEvent > ( ) . event ;
243+
243244 async resolveNotebook ( ) : Promise < void > { }
245+
244246 async saveNotebook ( document : vscode . NotebookDocument , cancellation : vscode . CancellationToken ) : Promise < void > {
245- await this . save ( document . uri , document , cancellation ) ;
247+ await this . save ( document , document . uri , cancellation ) ;
246248 }
247249
248250 async saveNotebookAs ( targetResource : vscode . Uri , document : vscode . NotebookDocument , cancellation : vscode . CancellationToken ) : Promise < void > {
249- await this . save ( targetResource , document , cancellation ) ;
251+ await this . save ( document , targetResource , cancellation ) ;
252+ }
253+
254+ async backupNotebook ( document : vscode . NotebookDocument , context : vscode . NotebookDocumentBackupContext , cancellation : vscode . CancellationToken ) : Promise < vscode . NotebookDocumentBackup > {
255+ await this . save ( document , context . destination , cancellation ) ;
256+ return {
257+ id : context . destination . toString ( ) ,
258+ delete : ( ) => vscode . workspace . fs . delete ( context . destination )
259+ } ;
250260 }
251261
252- async backupNotebook ( document : vscode . NotebookDocument , context : vscode . NotebookDocumentBackupContext , cancellation : vscode . CancellationToken ) : Promise < vscode . NotebookDocumentBackup > { return { id : '' , delete : ( ) => { } } ; }
253262 async executeCell ( document : vscode . NotebookDocument , cell : vscode . NotebookCell ) {
254263 const notebook = this . notebooks . get ( document . uri . toString ( ) ) ;
255264
0 commit comments