Skip to content

Commit

Permalink
add IInterpreterHashProviderFactory to the (#13632)
Browse files Browse the repository at this point in the history
ioc container
  • Loading branch information
David Kutugata authored Aug 27, 2020
1 parent 67c95c6 commit c37c79d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/client/interpreter/locators/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface IPipEnvServiceHelper {
* @export
* @interface IInterpreterHashProviderFactory
*/
export const IInterpreterHashProviderFactory = Symbol('IInterpreterHashProviderFactory');
export interface IInterpreterHashProviderFactory {
create(options: { pythonPath: string } | { resource: Uri }): Promise<IInterpreterHashProvider>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ export class InterpeterHashProviderFactory implements IInterpreterHashProviderFa
) {}

public async create(options: { pythonPath: string } | { resource: Uri }): Promise<IInterpreterHashProvider> {
const pythonPath =
'pythonPath' in options ? options.pythonPath : this.configService.getSettings(options.resource).pythonPath;
const pythonPath = 'pythonPath' in options
? options.pythonPath
: this.configService.getSettings(options.resource).pythonPath;
return this.windowsStoreInterpreter.isWindowsStoreInterpreter(pythonPath)
? this.windowsStoreHashProvider
: this.hashProvider;
Expand Down
6 changes: 6 additions & 0 deletions src/test/datascience/dataScienceIocContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,13 @@ import {
import { ShebangCodeLensProvider } from '../../client/interpreter/display/shebangCodeLensProvider';
import { InterpreterHelper } from '../../client/interpreter/helpers';
import { InterpreterVersionService } from '../../client/interpreter/interpreterVersion';
import { IInterpreterHashProviderFactory } from '../../client/interpreter/locators/types';
import { registerInterpreterTypes } from '../../client/interpreter/serviceRegistry';
import { VirtualEnvironmentManager } from '../../client/interpreter/virtualEnvs';
import { IVirtualEnvironmentManager } from '../../client/interpreter/virtualEnvs/types';
import { ProposePylanceBanner } from '../../client/languageServices/proposeLanguageServerBanner';
import { CacheableLocatorPromiseCache } from '../../client/pythonEnvironments/discovery/locators/services/cacheableLocatorService';
import { InterpeterHashProviderFactory } from '../../client/pythonEnvironments/discovery/locators/services/hashProviderFactory';
import { EnvironmentType, PythonEnvironment } from '../../client/pythonEnvironments/info';
import { registerForIOC } from '../../client/pythonEnvironments/legacyIOC';
import { CodeExecutionHelper } from '../../client/terminals/codeExecution/helper';
Expand Down Expand Up @@ -583,6 +585,10 @@ export class DataScienceIocContainer extends UnitTestIocContainer {
instance(this.webPanelProvider)
);
}
this.serviceManager.addSingleton<IInterpreterHashProviderFactory>(
IInterpreterHashProviderFactory,
InterpeterHashProviderFactory
);
this.serviceManager.addSingleton<IExportManager>(IExportManager, ExportManager);
this.serviceManager.addSingleton<ExportDependencyChecker>(ExportDependencyChecker, ExportDependencyChecker);
this.serviceManager.addSingleton<ExportFileOpener>(ExportFileOpener, ExportFileOpener);
Expand Down

0 comments on commit c37c79d

Please sign in to comment.