mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-06 09:35:41 -05:00
Book/untitled file name updates (#8579)
* file-name has entire path as name, changes to address that * await promises
This commit is contained in:
@@ -211,8 +211,8 @@ export class BookModel implements azdata.nb.NavigationProvider {
|
||||
if (notebook) {
|
||||
result = {
|
||||
hasNavigation: true,
|
||||
previous: notebook.previousUri ? this.openAsUntitled ? this.getPlatformSpecificUri(notebook.previousUri) : vscode.Uri.file(notebook.previousUri) : undefined,
|
||||
next: notebook.nextUri ? this.openAsUntitled ? this.getPlatformSpecificUri(notebook.nextUri) : vscode.Uri.file(notebook.nextUri) : undefined
|
||||
previous: notebook.previousUri ? this.openAsUntitled ? this.getUntitledUri(notebook.previousUri) : vscode.Uri.file(notebook.previousUri) : undefined,
|
||||
next: notebook.nextUri ? this.openAsUntitled ? this.getUntitledUri(notebook.nextUri) : vscode.Uri.file(notebook.nextUri) : undefined
|
||||
};
|
||||
} else {
|
||||
result = {
|
||||
@@ -224,12 +224,7 @@ export class BookModel implements azdata.nb.NavigationProvider {
|
||||
return Promise.resolve(result);
|
||||
}
|
||||
|
||||
getPlatformSpecificUri(resource: string): vscode.Uri {
|
||||
if (process.platform === 'win32') {
|
||||
return vscode.Uri.parse(`untitled:${resource}`);
|
||||
}
|
||||
else {
|
||||
return vscode.Uri.parse(resource).with({ scheme: 'untitled' });
|
||||
}
|
||||
getUntitledUri(resource: string): vscode.Uri {
|
||||
return vscode.Uri.parse(`untitled:${resource}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,13 +290,8 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
|
||||
|
||||
getUntitledNotebookUri(resource: string): vscode.Uri {
|
||||
let untitledFileName: vscode.Uri;
|
||||
if (process.platform === 'win32') {
|
||||
let title = path.join(path.dirname(resource), this.findNextUntitledFileName(resource));
|
||||
untitledFileName = vscode.Uri.parse(`untitled:${title}`);
|
||||
}
|
||||
else {
|
||||
untitledFileName = vscode.Uri.parse(resource).with({ scheme: 'untitled' });
|
||||
}
|
||||
let nextTitle: string = this.findNextUntitledFileName(resource);
|
||||
untitledFileName = vscode.Uri.parse(`untitled:${nextTitle}`);
|
||||
if (!this.currentBook.getAllBooks().get(untitledFileName.fsPath) && !this.currentBook.getAllBooks().get(path.basename(untitledFileName.fsPath))) {
|
||||
let notebook = this.currentBook.getAllBooks().get(resource);
|
||||
this.currentBook.getAllBooks().set(path.basename(untitledFileName.fsPath), notebook);
|
||||
|
||||
@@ -720,7 +720,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:${result.next.path}`);
|
||||
let untitledNbName: URI = URI.parse(`untitled:${path.basename(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 +733,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:${result.previous.path}`);
|
||||
let untitledNbName: URI = URI.parse(`untitled:${path.basename(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