diff --git a/src/client/common/application/commandManager.ts b/src/client/common/application/commandManager.ts index 498eec10f59a..b0ddb4d60198 100644 --- a/src/client/common/application/commandManager.ts +++ b/src/client/common/application/commandManager.ts @@ -1,17 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import { inject, injectable } from 'inversify'; +import { injectable } from 'inversify'; import { commands, Disposable, TextEditor, TextEditorEdit } from 'vscode'; import { ICommandNameArgumentTypeMapping } from './commands'; -import { ICommandManager, IJupyterExtensionDependencyManager } from './types'; +import { ICommandManager } from './types'; @injectable() export class CommandManager implements ICommandManager { - constructor( - @inject(IJupyterExtensionDependencyManager) - private jupyterExtensionDependencyManager: IJupyterExtensionDependencyManager, - ) {} + constructor() {} /** * Registers a command that can be invoked via a keyboard shortcut, @@ -73,11 +70,7 @@ export class CommandManager implements ICommandManager { E extends keyof ICommandNameArgumentTypeMapping, U extends ICommandNameArgumentTypeMapping[E] >(command: E, ...rest: U): Thenable { - if (command.includes('jupyter') && !this.jupyterExtensionDependencyManager.isJupyterExtensionInstalled) { - return this.jupyterExtensionDependencyManager.installJupyterExtension(this); - } else { - return commands.executeCommand(command, ...rest); - } + return commands.executeCommand(command, ...rest); } /** diff --git a/src/client/common/application/types.ts b/src/client/common/application/types.ts index 01df5613bd90..5f3e27014ef7 100644 --- a/src/client/common/application/types.ts +++ b/src/client/common/application/types.ts @@ -488,7 +488,6 @@ export interface ICommandManager { export const IJupyterExtensionDependencyManager = Symbol('IJupyterExtensionDependencyManager'); export interface IJupyterExtensionDependencyManager { readonly isJupyterExtensionInstalled: boolean; - installJupyterExtension(commandManager: ICommandManager): Promise; } export const IDocumentManager = Symbol('IDocumentManager'); diff --git a/src/client/common/utils/localize.ts b/src/client/common/utils/localize.ts index 80fd801ba783..6614f8017284 100644 --- a/src/client/common/utils/localize.ts +++ b/src/client/common/utils/localize.ts @@ -137,11 +137,6 @@ export namespace Pylance { } export namespace Jupyter { - export const jupyterExtensionRequired = localize( - 'Jupyter.extensionRequired', - 'The Jupyter extension is required to perform that task. Click Yes to open the Jupyter extension installation page.', - ); - export const jupyterExtensionNotInstalled = localize( 'Jupyter.extensionNotInstalled', "This feature is available in the Jupyter extension, which isn't currently installed.", diff --git a/src/client/jupyter/jupyterExtensionDependencyManager.ts b/src/client/jupyter/jupyterExtensionDependencyManager.ts index 0db458eac051..defd5ea38241 100644 --- a/src/client/jupyter/jupyterExtensionDependencyManager.ts +++ b/src/client/jupyter/jupyterExtensionDependencyManager.ts @@ -1,27 +1,13 @@ import { inject, injectable } from 'inversify'; -import { IApplicationShell, ICommandManager, IJupyterExtensionDependencyManager } from '../common/application/types'; +import { IJupyterExtensionDependencyManager } from '../common/application/types'; import { JUPYTER_EXTENSION_ID } from '../common/constants'; import { IExtensions } from '../common/types'; -import { Common, Jupyter } from '../common/utils/localize'; @injectable() export class JupyterExtensionDependencyManager implements IJupyterExtensionDependencyManager { - constructor( - @inject(IExtensions) private extensions: IExtensions, - @inject(IApplicationShell) private appShell: IApplicationShell, - ) {} + constructor(@inject(IExtensions) private extensions: IExtensions) {} public get isJupyterExtensionInstalled(): boolean { return this.extensions.getExtension(JUPYTER_EXTENSION_ID) !== undefined; } - - public async installJupyterExtension(commandManager: ICommandManager): Promise { - const yes = Common.bannerLabelYes(); - const no = Common.bannerLabelNo(); - const answer = await this.appShell.showErrorMessage(Jupyter.jupyterExtensionRequired(), yes, no); - if (answer === yes) { - commandManager.executeCommand('extension.open', JUPYTER_EXTENSION_ID); - } - return undefined; - } } diff --git a/src/client/jupyter/jupyterNotInstalledNotificationHelper.ts b/src/client/jupyter/jupyterNotInstalledNotificationHelper.ts index 328fa23ca955..c3c7ec578702 100644 --- a/src/client/jupyter/jupyterNotInstalledNotificationHelper.ts +++ b/src/client/jupyter/jupyterNotInstalledNotificationHelper.ts @@ -31,7 +31,7 @@ export class JupyterNotInstalledNotificationHelper implements IJupyterNotInstall return !isInstalled; } - public async jupyterNotInstalledPrompt(entrypoint: JupyterNotInstalledOrigin): Promise { + public async showJupyterNotInstalledPrompt(entrypoint: JupyterNotInstalledOrigin): Promise { sendTelemetryEvent(EventName.JUPYTER_NOT_INSTALLED_NOTIFICATION_DISPLAYED, undefined, { entrypoint }); const prompts = [Common.doNotShowAgain()]; diff --git a/src/client/jupyter/types.ts b/src/client/jupyter/types.ts index 14d0c868adbf..dec66cdcb729 100644 --- a/src/client/jupyter/types.ts +++ b/src/client/jupyter/types.ts @@ -57,5 +57,5 @@ export enum JupyterNotInstalledOrigin { export const IJupyterNotInstalledNotificationHelper = Symbol('IJupyterNotInstalledNotificationHelper'); export interface IJupyterNotInstalledNotificationHelper { shouldShowJupypterExtensionNotInstalledPrompt(): boolean; - jupyterNotInstalledPrompt(entrypoint: JupyterNotInstalledOrigin): Promise; + showJupyterNotInstalledPrompt(entrypoint: JupyterNotInstalledOrigin): Promise; } diff --git a/src/test/jupyter/jupyterNotInstalledNotificationHelper.unit.test.ts b/src/test/jupyter/jupyterNotInstalledNotificationHelper.unit.test.ts index f82b9cb0c8a6..6323e30aa09c 100644 --- a/src/test/jupyter/jupyterNotInstalledNotificationHelper.unit.test.ts +++ b/src/test/jupyter/jupyterNotInstalledNotificationHelper.unit.test.ts @@ -110,7 +110,7 @@ suite('Jupyter not installed notification helper', () => { ({ createGlobalPersistentState: createGlobalPersistentStateStub } as unknown) as IPersistentStateFactory, {} as IJupyterExtensionDependencyManager, ); - await notificationHelper.jupyterNotInstalledPrompt(JupyterNotInstalledOrigin.StartPageCreateBlankNotebook); + await notificationHelper.showJupyterNotInstalledPrompt(JupyterNotInstalledOrigin.StartPageCreateBlankNotebook); sinon.assert.calledOnce(createGlobalPersistentStateStub); sinon.assert.calledOnce(showInformationMessageStub); @@ -142,7 +142,7 @@ suite('Jupyter not installed notification helper', () => { ({ createGlobalPersistentState: createGlobalPersistentStateStub } as unknown) as IPersistentStateFactory, {} as IJupyterExtensionDependencyManager, ); - await notificationHelper.jupyterNotInstalledPrompt(JupyterNotInstalledOrigin.StartPageCreateBlankNotebook); + await notificationHelper.showJupyterNotInstalledPrompt(JupyterNotInstalledOrigin.StartPageCreateBlankNotebook); const result = notificationHelper.shouldShowJupypterExtensionNotInstalledPrompt();