diff --git a/src/client/activation/node/lspNotebooksExperiment.ts b/src/client/activation/node/lspNotebooksExperiment.ts index e1041a11a0a0..de0acde0600e 100644 --- a/src/client/activation/node/lspNotebooksExperiment.ts +++ b/src/client/activation/node/lspNotebooksExperiment.ts @@ -1,13 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. import { inject, injectable } from 'inversify'; -import { Disposable, extensions } from 'vscode'; -import { IConfigurationService, IDisposableRegistry } from '../../common/types'; -import { sendTelemetryEvent } from '../../telemetry'; -import { EventName } from '../../telemetry/constants'; -import { JUPYTER_EXTENSION_ID, PYLANCE_EXTENSION_ID } from '../../common/constants'; -import { IExtensionSingleActivationService, LanguageServerType } from '../types'; -import { traceLog, traceVerbose } from '../../logging'; +import { IExtensionSingleActivationService } from '../types'; +import { traceVerbose } from '../../logging'; import { IJupyterExtensionDependencyManager } from '../../common/application/types'; import { IServiceContainer } from '../../ioc/types'; import { sleep } from '../../common/utils/async'; @@ -17,28 +12,18 @@ import { JupyterExtensionIntegration } from '../../jupyter/jupyterIntegration'; export class LspNotebooksExperiment implements IExtensionSingleActivationService { public readonly supportedWorkspaceTypes = { untrustedWorkspace: true, virtualWorkspace: true }; - private pylanceExtensionChangeHandler: Disposable | undefined; - private isJupyterInstalled = false; - private isUsingPylance: boolean | undefined; - constructor( @inject(IServiceContainer) private readonly serviceContainer: IServiceContainer, - @inject(IConfigurationService) private readonly configurationService: IConfigurationService, - @inject(IDisposableRegistry) private readonly disposables: IDisposableRegistry, @inject(IJupyterExtensionDependencyManager) jupyterDependencyManager: IJupyterExtensionDependencyManager, ) { this.isJupyterInstalled = jupyterDependencyManager.isJupyterExtensionInstalled; } - public async activate(): Promise { - if (!LspNotebooksExperiment.isPylanceInstalled()) { - this.pylanceExtensionChangeHandler = extensions.onDidChange(this.pylanceExtensionsChangeHandler.bind(this)); - this.disposables.push(this.pylanceExtensionChangeHandler); - } - - this.updateExperimentSupport(); + // eslint-disable-next-line class-methods-use-this + public activate(): Promise { + return Promise.resolve(); } public async onJupyterInstalled(): Promise { @@ -47,34 +32,10 @@ export class LspNotebooksExperiment implements IExtensionSingleActivationService } await this.waitForJupyterToRegisterPythonPathFunction(); - this.updateExperimentSupport(); this.isJupyterInstalled = true; } - private updateExperimentSupport(): void { - const languageServerType = this.configurationService.getSettings().languageServer; - - this.isUsingPylance = false; - if (languageServerType !== LanguageServerType.Node) { - traceLog(`LSP Notebooks is disabled -- not using Pylance`); - } else if (!LspNotebooksExperiment.isJupyterInstalled()) { - traceLog(`LSP Notebooks is disabled -- Jupyter disabled or not installed`); - } else if (!LspNotebooksExperiment.isPylanceInstalled()) { - traceLog(`LSP Notebooks is disabled -- Pylance disabled or not installed`); - } else { - this.isUsingPylance = true; - traceLog(`LSP Notebooks is enabled`); - sendTelemetryEvent(EventName.PYTHON_EXPERIMENTS_LSP_NOTEBOOKS); - } - - if (!this.isUsingPylance) { - traceLog(`LSP Notebooks interactive window support is disabled -- not using Pylance`); - } else { - traceLog(`LSP Notebooks interactive window support is enabled`); - } - } - private async waitForJupyterToRegisterPythonPathFunction(): Promise { const jupyterExtensionIntegration = this.serviceContainer.get( JupyterExtensionIntegration, @@ -96,21 +57,4 @@ export class LspNotebooksExperiment implements IExtensionSingleActivationService traceVerbose(`Timed out waiting for Jupyter to call registerJupyterPythonPathFunction`); } } - - private static isPylanceInstalled(): boolean { - return !!extensions.getExtension(PYLANCE_EXTENSION_ID); - } - - private static isJupyterInstalled(): boolean { - return !!extensions.getExtension(JUPYTER_EXTENSION_ID); - } - - private async pylanceExtensionsChangeHandler(): Promise { - if (LspNotebooksExperiment.isPylanceInstalled() && this.pylanceExtensionChangeHandler) { - this.pylanceExtensionChangeHandler.dispose(); - this.pylanceExtensionChangeHandler = undefined; - - this.updateExperimentSupport(); - } - } }