Notebook saves are broken #3432 (#3478)

* Notebook saves are broken #3432

* Misc change

* Save notebook uri to This

* Untitled notebook save including review comments #3432

* Cleanup

* Misc changes
This commit is contained in:
Raj
2018-12-07 16:27:23 -08:00
committed by Kevin Cunnane
parent 2d4fdcb661
commit 96fb618390
6 changed files with 90 additions and 6 deletions

View File

@@ -29,6 +29,7 @@ export class NotebookService implements INotebookService {
private _managers: Map<string, INotebookManager> = new Map();
private _onNotebookEditorAdd = new Emitter<INotebookEditor>();
private _onNotebookEditorRemove = new Emitter<INotebookEditor>();
private _onNotebookEditorRename = new Emitter<INotebookEditor>();
private _editors = new Map<string, INotebookEditor>();
constructor() {
@@ -84,6 +85,10 @@ export class NotebookService implements INotebookService {
return this._onNotebookEditorRemove.event;
}
get onNotebookEditorRename(): Event<INotebookEditor> {
return this._onNotebookEditorRename.event;
}
addNotebookEditor(editor: INotebookEditor): void {
this._editors.set(editor.id, editor);
this._onNotebookEditorAdd.fire(editor);
@@ -103,6 +108,17 @@ export class NotebookService implements INotebookService {
return editors;
}
renameNotebookEditor(oldUri: URI, newUri: URI, currentEditor: INotebookEditor): void {
let oldUriKey = oldUri.toString();
if(this._editors.has(oldUriKey))
{
this._editors.delete(oldUriKey);
currentEditor.notebookParams.notebookUri = newUri;
this._editors.set(newUri.toString(), currentEditor);
this._onNotebookEditorRename.fire(currentEditor);
}
}
private sendNotebookCloseToProvider(editor: INotebookEditor) {
let notebookUri = editor.notebookParams.notebookUri;
let uriString = notebookUri.toString();