Skip to content

Commit c37c79d

Browse files
author
David Kutugata
authored
add IInterpreterHashProviderFactory to the (#13632)
ioc container
1 parent 67c95c6 commit c37c79d

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/client/interpreter/locators/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export interface IPipEnvServiceHelper {
2222
* @export
2323
* @interface IInterpreterHashProviderFactory
2424
*/
25+
export const IInterpreterHashProviderFactory = Symbol('IInterpreterHashProviderFactory');
2526
export interface IInterpreterHashProviderFactory {
2627
create(options: { pythonPath: string } | { resource: Uri }): Promise<IInterpreterHashProvider>;
2728
}

src/client/pythonEnvironments/discovery/locators/services/hashProviderFactory.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ export class InterpeterHashProviderFactory implements IInterpreterHashProviderFa
2424
) {}
2525

2626
public async create(options: { pythonPath: string } | { resource: Uri }): Promise<IInterpreterHashProvider> {
27-
const pythonPath =
28-
'pythonPath' in options ? options.pythonPath : this.configService.getSettings(options.resource).pythonPath;
27+
const pythonPath = 'pythonPath' in options
28+
? options.pythonPath
29+
: this.configService.getSettings(options.resource).pythonPath;
2930
return this.windowsStoreInterpreter.isWindowsStoreInterpreter(pythonPath)
3031
? this.windowsStoreHashProvider
3132
: this.hashProvider;

src/test/datascience/dataScienceIocContainer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,13 @@ import {
368368
import { ShebangCodeLensProvider } from '../../client/interpreter/display/shebangCodeLensProvider';
369369
import { InterpreterHelper } from '../../client/interpreter/helpers';
370370
import { InterpreterVersionService } from '../../client/interpreter/interpreterVersion';
371+
import { IInterpreterHashProviderFactory } from '../../client/interpreter/locators/types';
371372
import { registerInterpreterTypes } from '../../client/interpreter/serviceRegistry';
372373
import { VirtualEnvironmentManager } from '../../client/interpreter/virtualEnvs';
373374
import { IVirtualEnvironmentManager } from '../../client/interpreter/virtualEnvs/types';
374375
import { ProposePylanceBanner } from '../../client/languageServices/proposeLanguageServerBanner';
375376
import { CacheableLocatorPromiseCache } from '../../client/pythonEnvironments/discovery/locators/services/cacheableLocatorService';
377+
import { InterpeterHashProviderFactory } from '../../client/pythonEnvironments/discovery/locators/services/hashProviderFactory';
376378
import { EnvironmentType, PythonEnvironment } from '../../client/pythonEnvironments/info';
377379
import { registerForIOC } from '../../client/pythonEnvironments/legacyIOC';
378380
import { CodeExecutionHelper } from '../../client/terminals/codeExecution/helper';
@@ -583,6 +585,10 @@ export class DataScienceIocContainer extends UnitTestIocContainer {
583585
instance(this.webPanelProvider)
584586
);
585587
}
588+
this.serviceManager.addSingleton<IInterpreterHashProviderFactory>(
589+
IInterpreterHashProviderFactory,
590+
InterpeterHashProviderFactory
591+
);
586592
this.serviceManager.addSingleton<IExportManager>(IExportManager, ExportManager);
587593
this.serviceManager.addSingleton<ExportDependencyChecker>(ExportDependencyChecker, ExportDependencyChecker);
588594
this.serviceManager.addSingleton<ExportFileOpener>(ExportFileOpener, ExportFileOpener);

0 commit comments

Comments
 (0)