mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 09:35:37 -05:00
Unique title for opened notebooks (#10673)
* removing debug log * Ensure unique title for Nb launch * pr feedback * pr feedback * pr fedback * pr feedback
This commit is contained in:
@@ -79,7 +79,7 @@ export class NotebookService implements INotebookService {
|
||||
* @param content the notebook content
|
||||
*/
|
||||
async launchNotebookWithContent(title: string, content: string): Promise<azdata.nb.NotebookEditor> {
|
||||
const uri: vscode.Uri = vscode.Uri.parse(`untitled:${title}`);
|
||||
const uri: vscode.Uri = vscode.Uri.parse(`untitled:${this.findNextUntitledEditorName(title)}`);
|
||||
return await azdata.nb.showNotebookDocument(uri, {
|
||||
connectionProfile: undefined,
|
||||
preview: false,
|
||||
|
||||
@@ -124,7 +124,8 @@ export class PlatformService implements IPlatformService {
|
||||
}
|
||||
|
||||
isNotebookNameUsed(title: string): boolean {
|
||||
return (azdata.nb.notebookDocuments.findIndex(doc => doc.isUntitled && doc.fileName === title) > -1);
|
||||
return (azdata.nb.notebookDocuments.findIndex(doc => doc.isUntitled && doc.fileName === title) > -1)
|
||||
&& (vscode.workspace.textDocuments.findIndex(doc => doc.isUntitled && doc.fileName === title) > -1);
|
||||
}
|
||||
|
||||
async makeDirectory(path: string): Promise<void> {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { INotebookService, Notebook } from '../../services/notebookService';
|
||||
@@ -91,8 +90,8 @@ export class NotebookWizard extends WizardBase<NotebookWizard, NotebookWizardPag
|
||||
this.notebookService.backgroundExecuteNotebook(this.wizardInfo.taskName, notebook, 'deploy', this.platformService, env);
|
||||
} else {
|
||||
Object.assign(process.env, env);
|
||||
const title = path.basename(this.notebookService.getNotebookPath(this.wizardInfo.notebook));
|
||||
await this.notebookService.launchNotebookWithContent(title, JSON.stringify(notebook, undefined, 4));
|
||||
const notebookPath = this.notebookService.getNotebookPath(this.wizardInfo.notebook);
|
||||
await this.notebookService.launchNotebookWithContent(notebookPath, JSON.stringify(notebook, undefined, 4));
|
||||
}
|
||||
} catch (error) {
|
||||
vscode.window.showErrorMessage(error);
|
||||
|
||||
Reference in New Issue
Block a user