mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 09:35:37 -05:00
Books: Ensure associatedResource is Present for Untitled Notebooks that have a File Associated with them (#9037)
* Conditionally add associatedResource t untitled nb * Fix Jupyter Book notebook titles (#9039) * Fix notebook titles * Fix navigation links for books * Added comments Co-authored-by: Chris LaFreniere <40371649+chlafreniere@users.noreply.github.com> * PR comment nit Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -458,8 +458,13 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
|
||||
};
|
||||
let isUntitled: boolean = uri.scheme === Schemas.untitled;
|
||||
|
||||
const fileInput = isUntitled ? this._untitledEditorService.create({ untitledResource: uri, mode: 'notebook', initialValue: options.initialContent }) :
|
||||
this._editorService.createInput({ resource: uri, mode: 'notebook' });
|
||||
let fileInput;
|
||||
if (isUntitled && path.isAbsolute(uri.fsPath)) {
|
||||
fileInput = this._untitledEditorService.create({ associatedResource: uri, mode: 'notebook', initialValue: options.initialContent });
|
||||
} else {
|
||||
fileInput = isUntitled ? this._untitledEditorService.create({ untitledResource: uri, mode: 'notebook', initialValue: options.initialContent }) :
|
||||
this._editorService.createInput({ resource: uri, mode: 'notebook' });
|
||||
}
|
||||
let input: NotebookInput;
|
||||
if (isUntitled) {
|
||||
input = this._instantiationService.createInstance(UntitledNotebookInput, path.basename(uri.fsPath), uri, fileInput as UntitledTextEditorInput);
|
||||
@@ -720,7 +725,7 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
|
||||
let result = await this._proxy.$getNavigation(handle, uri);
|
||||
if (result) {
|
||||
if (result.next.scheme === Schemas.untitled) {
|
||||
let untitledNbName: URI = URI.parse(`untitled:${path.basename(result.next.path)}`);
|
||||
let untitledNbName: URI = URI.parse(`untitled:${result.next.path}`);
|
||||
let content = await this._fileService.readFile(URI.file(result.next.path));
|
||||
await this.doOpenEditor(untitledNbName, { initialContent: content.value.toString(), initialDirtyState: false });
|
||||
}
|
||||
@@ -733,7 +738,7 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
|
||||
let result = await this._proxy.$getNavigation(handle, uri);
|
||||
if (result) {
|
||||
if (result.previous.scheme === Schemas.untitled) {
|
||||
let untitledNbName: URI = URI.parse(`untitled:${path.basename(result.previous.path)}`);
|
||||
let untitledNbName: URI = URI.parse(`untitled:${result.previous.path}`);
|
||||
let content = await this._fileService.readFile(URI.file(result.previous.path));
|
||||
await this.doOpenEditor(untitledNbName, { initialContent: content.value.toString(), initialDirtyState: false });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user