mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -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
|
* @param content the notebook content
|
||||||
*/
|
*/
|
||||||
async launchNotebookWithContent(title: string, content: string): Promise<azdata.nb.NotebookEditor> {
|
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, {
|
return await azdata.nb.showNotebookDocument(uri, {
|
||||||
connectionProfile: undefined,
|
connectionProfile: undefined,
|
||||||
preview: false,
|
preview: false,
|
||||||
|
|||||||
@@ -124,7 +124,8 @@ export class PlatformService implements IPlatformService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isNotebookNameUsed(title: string): boolean {
|
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> {
|
async makeDirectory(path: string): Promise<void> {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* 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 vscode from 'vscode';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
import { INotebookService, Notebook } from '../../services/notebookService';
|
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);
|
this.notebookService.backgroundExecuteNotebook(this.wizardInfo.taskName, notebook, 'deploy', this.platformService, env);
|
||||||
} else {
|
} else {
|
||||||
Object.assign(process.env, env);
|
Object.assign(process.env, env);
|
||||||
const title = path.basename(this.notebookService.getNotebookPath(this.wizardInfo.notebook));
|
const notebookPath = this.notebookService.getNotebookPath(this.wizardInfo.notebook);
|
||||||
await this.notebookService.launchNotebookWithContent(title, JSON.stringify(notebook, undefined, 4));
|
await this.notebookService.launchNotebookWithContent(notebookPath, JSON.stringify(notebook, undefined, 4));
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
vscode.window.showErrorMessage(error);
|
vscode.window.showErrorMessage(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user