Skip to content

Commit ee929ac

Browse files
authored
Fixes to opening VSCode Notebook (#12671)
For #10496 Not sure how, but some changes seem to have gone amiss.
1 parent 5a4954a commit ee929ac

File tree

2 files changed

+31
-11
lines changed

2 files changed

+31
-11
lines changed

src/client/datascience/interactive-ipynb/nativeEditorStorage.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,27 @@ export class NativeEditorStorage implements INotebookStorage {
7474
return `${path.basename(model.file.fsPath)}-${uuid()}`;
7575
}
7676

77-
public load(file: Uri, possibleContents?: string, backupId?: string): Promise<INotebookModel>;
78-
// tslint:disable-next-line: unified-signatures
79-
public load(file: Uri, possibleContents?: string, skipDirtyContents?: boolean): Promise<INotebookModel>;
80-
// tslint:disable-next-line: no-any
81-
public load(file: Uri, possibleContents?: string, options?: any): Promise<INotebookModel> {
82-
return this.loadFromFile(file, possibleContents, options);
77+
public load(
78+
file: Uri,
79+
possibleContents?: string,
80+
backupId?: string,
81+
forVSCodeNotebook?: boolean
82+
): Promise<INotebookModel>;
83+
public load(
84+
file: Uri,
85+
possibleContents?: string,
86+
// tslint:disable-next-line: unified-signatures
87+
skipDirtyContents?: boolean,
88+
forVSCodeNotebook?: boolean
89+
): Promise<INotebookModel>;
90+
public load(
91+
file: Uri,
92+
possibleContents?: string,
93+
// tslint:disable-next-line: no-any
94+
options?: any,
95+
forVSCodeNotebook?: boolean
96+
): Promise<INotebookModel> {
97+
return this.loadFromFile(file, possibleContents, options, forVSCodeNotebook);
8398
}
8499
public async save(model: INotebookModel, _cancellation: CancellationToken): Promise<void> {
85100
const contents = model.getContent();

src/client/datascience/interactive-ipynb/notebookStorageProvider.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,25 @@ export class NotebookStorageProvider implements INotebookStorageProvider {
5656
public deleteBackup(model: INotebookModel, backupId?: string) {
5757
return this.storage.deleteBackup(model, backupId);
5858
}
59-
public load(file: Uri, contents?: string, backupId?: string): Promise<INotebookModel>;
60-
// tslint:disable-next-line: unified-signatures
61-
public load(file: Uri, contents?: string, skipDirtyContents?: boolean): Promise<INotebookModel>;
59+
public load(file: Uri, contents?: string, backupId?: string, forVSCodeNotebook?: boolean): Promise<INotebookModel>;
60+
public load(
61+
file: Uri,
62+
contents?: string,
63+
// tslint:disable-next-line: unified-signatures
64+
skipDirtyContents?: boolean,
65+
forVSCodeNotebook?: boolean
66+
): Promise<INotebookModel>;
6267

6368
// tslint:disable-next-line: no-any
64-
public load(file: Uri, contents?: string, options?: any): Promise<INotebookModel> {
69+
public load(file: Uri, contents?: string, options?: any, forVSCodeNotebook?: boolean): Promise<INotebookModel> {
6570
const key = file.toString();
6671
if (!this.storageAndModels.has(key)) {
6772
// Every time we load a new untitled file, up the counter past the max value for this counter
6873
NotebookStorageProvider.untitledCounter = getNextUntitledCounter(
6974
file,
7075
NotebookStorageProvider.untitledCounter
7176
);
72-
const promise = this.storage.load(file, contents, options);
77+
const promise = this.storage.load(file, contents, options, forVSCodeNotebook);
7378
this.storageAndModels.set(key, promise.then(this.trackModel.bind(this)));
7479
}
7580
return this.storageAndModels.get(key)!;

0 commit comments

Comments
 (0)