diff --git a/src/client/application/diagnostics/checks/macPythonInterpreter.ts b/src/client/application/diagnostics/checks/macPythonInterpreter.ts index d1bebed87ab7..556d2ee6a249 100644 --- a/src/client/application/diagnostics/checks/macPythonInterpreter.ts +++ b/src/client/application/diagnostics/checks/macPythonInterpreter.ts @@ -14,9 +14,8 @@ import { InterpreterConfigurationScope, Resource, } from '../../../common/types'; -import { IInterpreterHelper, IInterpreterService } from '../../../interpreter/contracts'; +import { IInterpreterHelper } from '../../../interpreter/contracts'; import { IServiceContainer } from '../../../ioc/types'; -import { EnvironmentType } from '../../../pythonEnvironments/info'; import { BaseDiagnostic, BaseDiagnosticsService } from '../base'; import { IDiagnosticsCommandFactory } from '../commands/types'; import { DiagnosticCodes } from '../constants'; @@ -26,23 +25,14 @@ import { DiagnosticScope, IDiagnostic, IDiagnosticCommand, IDiagnosticHandlerSer const localize: nls.LocalizeFunc = nls.loadMessageBundle(); const messages = { - [DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic]: localize( - 'DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic', - 'You have selected the macOS system install of Python, which is not recommended for use with the Python extension. Some functionality will be limited, please select a different interpreter.', - ), - [DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic]: localize( - 'DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic', - 'The macOS system install of Python is not recommended, some functionality in the extension will be limited. Install another version of Python for the best experience.', + [DiagnosticCodes.MacInterpreterSelected]: localize( + 'DiagnosticCodes.MacInterpreterSelected', + 'The selected macOS system install of Python is not recommended, some functionality in the extension will be limited. [Install another version of Python](https://www.python.org/downloads) or select a different interpreter for the best experience. [Learn more](https://aka.ms/AA7jfor).', ), }; export class InvalidMacPythonInterpreterDiagnostic extends BaseDiagnostic { - constructor( - code: - | DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic - | DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic, - resource: Resource, - ) { + constructor(code: DiagnosticCodes.MacInterpreterSelected, resource: Resource) { super(code, messages[code], DiagnosticSeverity.Error, DiagnosticScope.WorkspaceFolder, resource); } } @@ -57,20 +47,11 @@ export class InvalidMacPythonInterpreterService extends BaseDiagnosticsService { constructor( @inject(IServiceContainer) serviceContainer: IServiceContainer, - @inject(IInterpreterService) private readonly interpreterService: IInterpreterService, @inject(IDisposableRegistry) disposableRegistry: IDisposableRegistry, @inject(IPlatformService) private readonly platform: IPlatformService, @inject(IInterpreterHelper) private readonly helper: IInterpreterHelper, ) { - super( - [ - DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic, - DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic, - ], - serviceContainer, - disposableRegistry, - true, - ); + super([DiagnosticCodes.MacInterpreterSelected], serviceContainer, disposableRegistry, true); this.addPythonPathChangedHandler(); } @@ -90,44 +71,10 @@ export class InvalidMacPythonInterpreterService extends BaseDiagnosticsService { if (settings.disableInstallationChecks === true) { return []; } - - const hasInterpreters = await this.interpreterService.hasInterpreters(); - if (!hasInterpreters) { - return []; - } - - const currentInterpreter = await this.interpreterService.getActiveInterpreter(resource); - if (!currentInterpreter) { - return []; - } - if (!(await this.helper.isMacDefaultPythonPath(settings.pythonPath))) { return []; } - if (!currentInterpreter || currentInterpreter.envType !== EnvironmentType.Unknown) { - return []; - } - - if ( - await this.interpreterService.hasInterpreters((e) => - this.helper.isMacDefaultPythonPath(e.path).then((x) => !x), - ) - ) { - // If non-mac default interpreters exist. - return [ - new InvalidMacPythonInterpreterDiagnostic( - DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic, - resource, - ), - ]; - } - - return [ - new InvalidMacPythonInterpreterDiagnostic( - DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic, - resource, - ), - ]; + return [new InvalidMacPythonInterpreterDiagnostic(DiagnosticCodes.MacInterpreterSelected, resource)]; } protected async onHandle(diagnostics: IDiagnostic[]): Promise { @@ -177,7 +124,7 @@ export class InvalidMacPythonInterpreterService extends BaseDiagnosticsService { private getCommandPrompts(diagnostic: IDiagnostic): { prompt: string; command?: IDiagnosticCommand }[] { const commandFactory = this.serviceContainer.get(IDiagnosticsCommandFactory); switch (diagnostic.code) { - case DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic: { + case DiagnosticCodes.MacInterpreterSelected: { return [ { prompt: 'Select Python Interpreter', @@ -195,31 +142,6 @@ export class InvalidMacPythonInterpreterService extends BaseDiagnosticsService { }, ]; } - case DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic: { - return [ - { - prompt: 'Learn more', - command: commandFactory.createCommand(diagnostic, { - type: 'launch', - options: 'https://code.visualstudio.com/docs/python/python-tutorial#_prerequisites', - }), - }, - { - prompt: 'Download', - command: commandFactory.createCommand(diagnostic, { - type: 'launch', - options: 'https://www.python.org/downloads', - }), - }, - { - prompt: 'Do not show again', - command: commandFactory.createCommand(diagnostic, { - type: 'ignore', - options: DiagnosticScope.Global, - }), - }, - ]; - } default: { throw new Error("Invalid diagnostic for 'InvalidMacPythonInterpreterService'"); } diff --git a/src/client/application/diagnostics/constants.ts b/src/client/application/diagnostics/constants.ts index 18f2d2bc08b2..850b7dab3855 100644 --- a/src/client/application/diagnostics/constants.ts +++ b/src/client/application/diagnostics/constants.ts @@ -7,8 +7,7 @@ export enum DiagnosticCodes { InvalidEnvironmentPathVariableDiagnostic = 'InvalidEnvironmentPathVariableDiagnostic', InvalidDebuggerTypeDiagnostic = 'InvalidDebuggerTypeDiagnostic', NoPythonInterpretersDiagnostic = 'NoPythonInterpretersDiagnostic', - MacInterpreterSelectedAndNoOtherInterpretersDiagnostic = 'MacInterpreterSelectedAndNoOtherInterpretersDiagnostic', - MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic = 'MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic', + MacInterpreterSelected = 'MacInterpreterSelected', InvalidPythonPathInDebuggerSettingsDiagnostic = 'InvalidPythonPathInDebuggerSettingsDiagnostic', InvalidPythonPathInDebuggerLaunchDiagnostic = 'InvalidPythonPathInDebuggerLaunchDiagnostic', EnvironmentActivationInPowerShellWithBatchFilesNotSupportedDiagnostic = 'EnvironmentActivationInPowerShellWithBatchFilesNotSupportedDiagnostic', diff --git a/src/client/debugger/extension/adapter/factory.ts b/src/client/debugger/extension/adapter/factory.ts index a001ba2ad42c..26a7afeba1f3 100644 --- a/src/client/debugger/extension/adapter/factory.ts +++ b/src/client/debugger/extension/adapter/factory.ts @@ -132,7 +132,7 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac } await this.interpreterService.hasInterpreters(); // Wait until we know whether we have an interpreter - const interpreters = await this.interpreterService.getInterpreters(resourceUri); + const interpreters = this.interpreterService.getInterpreters(resourceUri); if (interpreters.length === 0) { this.notifySelectInterpreter().ignoreErrors(); return []; diff --git a/src/client/interpreter/contracts.ts b/src/client/interpreter/contracts.ts index 7c85cb7d2bc7..9aecb0612326 100644 --- a/src/client/interpreter/contracts.ts +++ b/src/client/interpreter/contracts.ts @@ -73,6 +73,10 @@ export interface IInterpreterService { onDidChangeInterpreterConfiguration: Event; onDidChangeInterpreter: Event; onDidChangeInterpreterInformation: Event; + /** + * Note this API does not trigger the refresh but only works with the current refresh if any. Information + * returned by this is more or less upto date but is not guaranteed to be. + */ hasInterpreters(filter?: (e: PythonEnvironment) => Promise): Promise; getInterpreters(resource?: Uri): PythonEnvironment[]; /** diff --git a/src/client/pythonEnvironments/legacyIOC.ts b/src/client/pythonEnvironments/legacyIOC.ts index 9a18aa1508fd..e3481601d5ad 100644 --- a/src/client/pythonEnvironments/legacyIOC.ts +++ b/src/client/pythonEnvironments/legacyIOC.ts @@ -220,12 +220,13 @@ class ComponentAdapter implements IComponentAdapter { } } }); - const initialEnvs = this.api.getEnvs(); + const initialEnvs = await asyncFilter(this.api.getEnvs(), (e) => filter(convertEnvInfo(e))); if (initialEnvs.length > 0) { return true; } - // We should already have initiated discovery. Wait for an env to be added - // to the collection until the refresh has finished. + // Wait for an env to be added to the collection until the refresh has finished. Note although it's not + // guaranteed we have initiated discovery in this session, we do trigger refresh in the very first session, + // when Python is not installed, etc. Assuming list is more or less upto date. await Promise.race([onAddedToCollection.promise, this.api.getRefreshPromise()]); const envs = await asyncFilter(this.api.getEnvs(), (e) => filter(convertEnvInfo(e))); return envs.length > 0; diff --git a/src/client/startupTelemetry.ts b/src/client/startupTelemetry.ts index 48fd3203a4ba..8a123d6bee36 100644 --- a/src/client/startupTelemetry.ts +++ b/src/client/startupTelemetry.ts @@ -88,16 +88,9 @@ async function getActivationTelemetryProps(serviceContainer: IServiceContainer): if (!workspaceService.isTrusted) { return { workspaceFolderCount, terminal: terminalShellType }; } - const condaLocator = serviceContainer.get(ICondaService); const interpreterService = serviceContainer.get(IInterpreterService); const mainWorkspaceUri = workspaceService.workspaceFolders ? workspaceService.workspaceFolders[0].uri : undefined; - const [condaVersion, hasPythonThree] = await Promise.all([ - condaLocator - .getCondaVersion() - .then((ver) => (ver ? ver.raw : '')) - .catch(() => ''), - interpreterService.hasInterpreters(async (item) => item.version?.major === 3), - ]); + const hasPythonThree = await interpreterService.hasInterpreters(async (item) => item.version?.major === 3); // If an unknown type environment can be found from windows registry or path env var, // consider them as global type instead of unknown. Such types can only be known after // windows registry is queried. So wait for the refresh of windows registry locator to @@ -112,6 +105,14 @@ async function getActivationTelemetryProps(serviceContainer: IServiceContainer): if (interpreterType === EnvironmentType.Unknown) { traceError('Active interpreter type is detected as Unknown', JSON.stringify(interpreter)); } + let condaVersion = undefined; + if (interpreterType === EnvironmentType.Conda) { + const condaLocator = serviceContainer.get(ICondaService); + condaVersion = await condaLocator + .getCondaVersion() + .then((ver) => (ver ? ver.raw : '')) + .catch(() => ''); + } const usingUserDefinedInterpreter = hasUserDefinedPythonPath(mainWorkspaceUri, serviceContainer); const usingGlobalInterpreter = interpreter ? isUsingGlobalInterpreterInWorkspace(interpreter.path, serviceContainer) diff --git a/src/test/application/diagnostics/checks/macPythonInterpreter.unit.test.ts b/src/test/application/diagnostics/checks/macPythonInterpreter.unit.test.ts index 5a2453eb9072..de46d09013df 100644 --- a/src/test/application/diagnostics/checks/macPythonInterpreter.unit.test.ts +++ b/src/test/application/diagnostics/checks/macPythonInterpreter.unit.test.ts @@ -36,16 +36,14 @@ import { } from '../../../../client/common/types'; import { sleep } from '../../../../client/common/utils/async'; import { noop } from '../../../../client/common/utils/misc'; -import { IInterpreterHelper, IInterpreterService } from '../../../../client/interpreter/contracts'; +import { IInterpreterHelper } from '../../../../client/interpreter/contracts'; import { IServiceContainer } from '../../../../client/ioc/types'; -import { EnvironmentType } from '../../../../client/pythonEnvironments/info'; suite('Application Diagnostics - Checks Mac Python Interpreter', () => { let diagnosticService: IDiagnosticsService; let messageHandler: typemoq.IMock>; let commandFactory: typemoq.IMock; let settings: typemoq.IMock; - let interpreterService: typemoq.IMock; let platformService: typemoq.IMock; let helper: typemoq.IMock; let filterService: typemoq.IMock; @@ -74,10 +72,6 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { serviceContainer .setup((s) => s.get(typemoq.It.isValue(IConfigurationService))) .returns(() => configService.object); - interpreterService = typemoq.Mock.ofType(); - serviceContainer - .setup((s) => s.get(typemoq.It.isValue(IInterpreterService))) - .returns(() => interpreterService.object); platformService = typemoq.Mock.ofType(); serviceContainer .setup((s) => s.get(typemoq.It.isValue(IPlatformService))) @@ -111,15 +105,12 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { protected addPythonPathChangedHandler() { noop(); } - })(createContainer(), interpreterService.object, [], platformService.object, helper.object); + })(createContainer(), [], platformService.object, helper.object); (diagnosticService as any)._clear(); }); test('Can handle InvalidPythonPathInterpreter diagnostics', async () => { - for (const code of [ - DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic, - DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic, - ]) { + for (const code of [DiagnosticCodes.MacInterpreterSelected]) { const diagnostic = typemoq.Mock.ofType(); diagnostic .setup((d) => d.code) @@ -164,55 +155,11 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { settings.verifyAll(); platformService.verifyAll(); }); - test('Should return empty diagnostics if there are interpreters, one is selected, and platform is not mac', async () => { - settings - .setup((s) => s.disableInstallationChecks) - .returns(() => false) - .verifiable(typemoq.Times.once()); - interpreterService - .setup((i) => i.hasInterpreters()) - .returns(() => Promise.resolve(true)) - .verifiable(typemoq.Times.once()); - interpreterService - .setup((i) => i.getInterpreters(typemoq.It.isAny())) - .returns(() => ({} as any)) - .verifiable(typemoq.Times.never()); - interpreterService - .setup((i) => i.getActiveInterpreter(typemoq.It.isAny())) - .returns(() => { - return Promise.resolve({ envType: EnvironmentType.Unknown } as any); - }) - .verifiable(typemoq.Times.once()); - platformService - .setup((i) => i.isMac) - .returns(() => false) - .verifiable(typemoq.Times.once()); - - const diagnostics = await diagnosticService.diagnose(undefined); - expect(diagnostics).to.be.deep.equal([]); - settings.verifyAll(); - interpreterService.verifyAll(); - platformService.verifyAll(); - }); - test('Should return empty diagnostics if there are interpreters, platform is mac and selected interpreter is not default mac interpreter', async () => { + test('Should return empty diagnostics if platform is mac and selected interpreter is not default mac interpreter', async () => { settings .setup((s) => s.disableInstallationChecks) .returns(() => false) .verifiable(typemoq.Times.once()); - interpreterService - .setup((i) => i.hasInterpreters()) - .returns(() => Promise.resolve(true)) - .verifiable(typemoq.Times.once()); - interpreterService - .setup((i) => i.getInterpreters(typemoq.It.isAny())) - .returns(() => ({} as any)) - .verifiable(typemoq.Times.never()); - interpreterService - .setup((i) => i.getActiveInterpreter(typemoq.It.isAny())) - .returns(() => { - return Promise.resolve({ envType: EnvironmentType.Unknown } as any); - }) - .verifiable(typemoq.Times.once()); platformService .setup((i) => i.isMac) .returns(() => true) @@ -225,63 +172,15 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { const diagnostics = await diagnosticService.diagnose(undefined); expect(diagnostics).to.be.deep.equal([]); settings.verifyAll(); - interpreterService.verifyAll(); platformService.verifyAll(); helper.verifyAll(); }); - test('Should return diagnostic if there are no other interpreters, platform is mac and selected interpreter is default mac interpreter', async () => { + test('Should return diagnostic if platform is mac and selected interpreter is default mac interpreter', async () => { settings .setup((s) => s.disableInstallationChecks) .returns(() => false) .verifiable(typemoq.Times.once()); - interpreterService - .setup((i) => i.hasInterpreters()) - .returns(() => Promise.resolve(true)) - .verifiable(typemoq.Times.once()); - interpreterService - .setup((i) => i.hasInterpreters(typemoq.It.isAny())) - .returns(() => Promise.resolve(false)) - .verifiable(typemoq.Times.once()); - interpreterService - .setup((i) => i.getActiveInterpreter(typemoq.It.isAny())) - .returns(() => { - return Promise.resolve({ envType: EnvironmentType.Unknown } as any); - }) - .verifiable(typemoq.Times.once()); - platformService - .setup((i) => i.isMac) - .returns(() => true) - .verifiable(typemoq.Times.once()); - helper - .setup((i) => i.isMacDefaultPythonPath(typemoq.It.isValue(pythonPath))) - .returns(() => Promise.resolve(true)) - .verifiable(typemoq.Times.atLeastOnce()); - const diagnostics = await diagnosticService.diagnose(undefined); - expect(diagnostics).to.be.deep.equal( - [ - new InvalidMacPythonInterpreterDiagnostic( - DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic, - undefined, - ), - ], - 'not the same', - ); - }); - test('Should return diagnostic if there are other interpreters, platform is mac and selected interpreter is default mac interpreter', async () => { - const nonMacStandardInterpreter = 'Non Mac Std Interpreter'; - settings - .setup((s) => s.disableInstallationChecks) - .returns(() => false) - .verifiable(typemoq.Times.once()); - interpreterService - .setup((i) => i.hasInterpreters()) - .returns(() => Promise.resolve(true)) - .verifiable(typemoq.Times.once()); - interpreterService - .setup((i) => i.hasInterpreters(typemoq.It.isAny())) - .returns(() => Promise.resolve(true)) - .verifiable(typemoq.Times.once()); platformService .setup((i) => i.isMac) .returns(() => true) @@ -290,31 +189,16 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { .setup((i) => i.isMacDefaultPythonPath(typemoq.It.isValue(pythonPath))) .returns(() => Promise.resolve(true)) .verifiable(typemoq.Times.atLeastOnce()); - helper - .setup((i) => i.isMacDefaultPythonPath(typemoq.It.isValue(nonMacStandardInterpreter))) - .returns(() => Promise.resolve(false)) - .verifiable(typemoq.Times.atLeastOnce()); - interpreterService - .setup((i) => i.getActiveInterpreter(typemoq.It.isAny())) - .returns(() => { - return Promise.resolve({ envType: EnvironmentType.Unknown } as any); - }) - .verifiable(typemoq.Times.once()); const diagnostics = await diagnosticService.diagnose(undefined); expect(diagnostics).to.be.deep.equal( - [ - new InvalidMacPythonInterpreterDiagnostic( - DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic, - undefined, - ), - ], + [new InvalidMacPythonInterpreterDiagnostic(DiagnosticCodes.MacInterpreterSelected, undefined)], 'not the same', ); }); test('Handling no interpreters diagnostic should return select interpreter cmd', async () => { const diagnostic = new InvalidMacPythonInterpreterDiagnostic( - DiagnosticCodes.MacInterpreterSelectedAndHaveOtherInterpretersDiagnostic, + DiagnosticCodes.MacInterpreterSelected, undefined, ); const cmd = ({} as any) as IDiagnosticCommand; @@ -359,80 +243,14 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { { prompt: 'Do not show again', command: cmdIgnore }, ]); }); - test('Handling no interpreters diagnostisc should return 3 commands', async () => { - const diagnostic = new InvalidMacPythonInterpreterDiagnostic( - DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic, - undefined, - ); - const cmdDownload = ({} as any) as IDiagnosticCommand; - const cmdLearn = ({} as any) as IDiagnosticCommand; - const cmdIgnore = ({} as any) as IDiagnosticCommand; - let messagePrompt: MessageCommandPrompt | undefined; - messageHandler - .setup((i) => i.handle(typemoq.It.isValue(diagnostic), typemoq.It.isAny())) - .callback((_d, p: MessageCommandPrompt) => (messagePrompt = p)) - .returns(() => Promise.resolve()) - .verifiable(typemoq.Times.once()); - commandFactory - .setup((f) => - f.createCommand( - typemoq.It.isAny(), - typemoq.It.isObjectWith>({ - type: 'launch', - options: 'https://code.visualstudio.com/docs/python/python-tutorial#_prerequisites', - }), - ), - ) - .returns(() => cmdLearn) - .verifiable(typemoq.Times.once()); - commandFactory - .setup((f) => - f.createCommand( - typemoq.It.isAny(), - typemoq.It.isObjectWith>({ - type: 'launch', - options: 'https://www.python.org/downloads', - }), - ), - ) - .returns(() => cmdDownload) - .verifiable(typemoq.Times.once()); - commandFactory - .setup((f) => - f.createCommand( - typemoq.It.isAny(), - typemoq.It.isObjectWith>({ - type: 'ignore', - options: DiagnosticScope.Global, - }), - ), - ) - .returns(() => cmdIgnore) - .verifiable(typemoq.Times.once()); - - await diagnosticService.handle([diagnostic]); - - messageHandler.verifyAll(); - commandFactory.verifyAll(); - expect(messagePrompt).not.be.equal(undefined, 'Message prompt not set'); - expect(messagePrompt!.commandPrompts).to.be.deep.equal([ - { prompt: 'Learn more', command: cmdLearn }, - { prompt: 'Download', command: cmdDownload }, - { prompt: 'Do not show again', command: cmdIgnore }, - ]); - }); test('Should not display a message if No Interpreters diagnostic has been ignored', async () => { const diagnostic = new InvalidMacPythonInterpreterDiagnostic( - DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic, + DiagnosticCodes.MacInterpreterSelected, undefined, ); filterService - .setup((f) => - f.shouldIgnoreDiagnostic( - typemoq.It.isValue(DiagnosticCodes.MacInterpreterSelectedAndNoOtherInterpretersDiagnostic), - ), - ) + .setup((f) => f.shouldIgnoreDiagnostic(typemoq.It.isValue(DiagnosticCodes.MacInterpreterSelected))) .returns(() => Promise.resolve(true)) .verifiable(typemoq.Times.once()); commandFactory @@ -457,7 +275,7 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { protected addPythonPathChangedHandler() { invoked = true; } - })(createContainer(), interpreterService.object, [], platformService.object, helper.object); + })(createContainer(), [], platformService.object, helper.object); expect(invoked).to.be.equal(true, 'Not invoked'); }); @@ -475,13 +293,8 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { .returns(() => workspaceService.object); const diagnosticSvc = new (class extends InvalidMacPythonInterpreterService { - constructor( - arg1: IServiceContainer, - arg2: IInterpreterService, - arg3: IPlatformService, - arg4: IInterpreterHelper, - ) { - super(arg1, arg2, [], arg3, arg4); + constructor(arg1: IServiceContainer, arg3: IPlatformService, arg4: IInterpreterHelper) { + super(arg1, [], arg3, arg4); this.changeThrottleTimeout = 1; } public onDidChangeConfigurationEx = (e: InterpreterConfigurationScope) => @@ -492,7 +305,6 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { } })( serviceContainerObject, - typemoq.Mock.ofType().object, typemoq.Mock.ofType().object, typemoq.Mock.ofType().object, ); @@ -521,13 +333,8 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { .returns(() => workspaceService.object); const diagnosticSvc = new (class extends InvalidMacPythonInterpreterService { - constructor( - arg1: IServiceContainer, - arg2: IInterpreterService, - arg3: IPlatformService, - arg4: IInterpreterHelper, - ) { - super(arg1, arg2, [], arg3, arg4); + constructor(arg1: IServiceContainer, arg3: IPlatformService, arg4: IInterpreterHelper) { + super(arg1, [], arg3, arg4); this.changeThrottleTimeout = 100; } public onDidChangeConfigurationEx = (e: InterpreterConfigurationScope) => @@ -538,7 +345,6 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { } })( serviceContainerObject, - typemoq.Mock.ofType().object, typemoq.Mock.ofType().object, typemoq.Mock.ofType().object, ); @@ -571,7 +377,7 @@ suite('Application Diagnostics - Checks Mac Python Interpreter', () => { protected async onDidChangeConfiguration(_i: InterpreterConfigurationScope) { invoked = true; } - })(serviceContainerObject, undefined as any, [], undefined as any, undefined as any); + })(serviceContainerObject, [], undefined as any, undefined as any); expect(interpreterPathServiceHandler!).to.not.equal(undefined, 'Handler not set'); await interpreterPathServiceHandler!({} as any);