@@ -2,7 +2,7 @@ import type { nbformat } from '@jupyterlab/coreutils';
22import { inject , injectable , named } from 'inversify' ;
33import * as path from 'path' ;
44import * as uuid from 'uuid/v4' ;
5- import { CancellationToken , Event , EventEmitter , Memento , Uri } from 'vscode' ;
5+ import { CancellationToken , Memento , Uri } from 'vscode' ;
66import { createCodeCell } from '../../../datascience-ui/common/cellFactory' ;
77import { traceError } from '../../common/logger' ;
88import { isFileNotFoundError } from '../../common/platform/errors' ;
@@ -24,6 +24,7 @@ import {
2424
2525// tslint:disable-next-line:no-require-imports no-var-requires
2626import detectIndent = require( 'detect-indent' ) ;
27+ import { VSCodeNotebookModel } from './vscNotebookModel' ;
2728
2829const KeyPrefix = 'notebook-storage-' ;
2930const NotebookTransferKey = 'notebook-transfered' ;
@@ -53,11 +54,6 @@ export function getNextUntitledCounter(file: Uri | undefined, currentValue: numb
5354
5455@injectable ( )
5556export class NativeEditorStorage implements INotebookStorage {
56- public get onSavedAs ( ) : Event < { new : Uri ; old : Uri } > {
57- return this . savedAs . event ;
58- }
59- private readonly savedAs = new EventEmitter < { new : Uri ; old : Uri } > ( ) ;
60-
6157 // Keep track of if we are backing up our file already
6258 private backingUp = false ;
6359 // If backup requests come in while we are already backing up save the most recent one here
@@ -119,13 +115,15 @@ export class NativeEditorStorage implements INotebookStorage {
119115 }
120116
121117 public async saveAs ( model : INotebookModel , file : Uri ) : Promise < void > {
122- const old = model . file ;
123118 const contents = model . getContent ( ) ;
124119 const parallelize = [ this . fs . writeFile ( file , contents ) ] ;
125120 if ( model . isTrusted ) {
126121 parallelize . push ( this . trustService . trustNotebook ( file , contents ) ) ;
127122 }
128123 await Promise . all ( parallelize ) ;
124+ if ( model instanceof VSCodeNotebookModel ) {
125+ return ;
126+ }
129127 model . update ( {
130128 source : 'user' ,
131129 kind : 'saveAs' ,
@@ -134,7 +132,6 @@ export class NativeEditorStorage implements INotebookStorage {
134132 target : file ,
135133 sourceUri : model . file
136134 } ) ;
137- this . savedAs . fire ( { new : file , old } ) ;
138135 }
139136 public async backup ( model : INotebookModel , cancellation : CancellationToken , backupId ?: string ) : Promise < void > {
140137 // If we are already backing up, save this request replacing any other previous requests
0 commit comments