Create untitled notebook names in core code rather than in the notebook extension (#21111)

This commit is contained in:
Cory Rivera
2022-11-04 19:31:55 -07:00
committed by GitHub
parent a618ef983a
commit facd317b4d
9 changed files with 63 additions and 94 deletions

View File

@@ -29,8 +29,6 @@ import { ManagePackagesDialogModel, ManagePackageDialogOptions } from '../dialog
import { PyPiClient } from './pypiClient';
import { JupyterExecuteProvider } from './jupyterExecuteProvider';
let untitledCounter = 0;
export class JupyterController {
private _jupyterInstallation: JupyterServerInstallation;
private _serverInstanceFactory: ServerInstanceFactory = new ServerInstanceFactory();
@@ -133,10 +131,7 @@ export class JupyterController {
}
private async handleNewNotebookTask(oeContext?: azdata.ObjectExplorerContext, profile?: azdata.IConnectionProfile): Promise<void> {
// Ensure we get a unique ID for the notebook. For now we're using a different prefix to the built-in untitled files
// to handle this. We should look into improving this in the future
let untitledUri = vscode.Uri.parse(`untitled:Notebook-${untitledCounter++}`);
let editor = await azdata.nb.showNotebookDocument(untitledUri, {
let editor = await azdata.nb.showNotebookDocument(vscode.Uri.from({ scheme: 'untitled' }), {
connectionProfile: profile,
providerId: constants.jupyterNotebookProviderId,
preview: false,