Skip to content

Commit 0f2bea5

Browse files
authored
Fix typo in the word selection (microsoft#15309)
* Fix typo in the word selection * Cleanup eslintignore
1 parent db3e9c6 commit 0f2bea5

23 files changed

Lines changed: 347 additions & 284 deletions

.eslintignore

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ src/test/initialize.ts
2525
src/test/mockClasses.ts
2626
src/test/performanceTest.ts
2727
src/test/proc.ts
28-
src/test/serviceRegistry.ts
2928
src/test/smokeTest.ts
3029
src/test/standardTest.ts
3130
src/test/startupTelemetry.unit.test.ts
@@ -42,10 +41,8 @@ src/test/interpreters/mocks.ts
4241
src/test/interpreters/interpreterVersion.unit.test.ts
4342
src/test/interpreters/virtualEnvs/index.unit.test.ts
4443
src/test/interpreters/virtualEnvs/condaInheritEnvPrompt.unit.test.ts
45-
src/test/interpreters/autoSelection/proxy.unit.test.ts
4644
src/test/interpreters/autoSelection/interpreterSecurity/interpreterEvaluation.unit.test.ts
4745
src/test/interpreters/autoSelection/interpreterSecurity/interpreterSecurityService.unit.test.ts
48-
src/test/interpreters/autoSelection/index.unit.test.ts
4946
src/test/interpreters/autoSelection/rules/settings.unit.test.ts
5047
src/test/interpreters/autoSelection/rules/cached.unit.test.ts
5148
src/test/interpreters/autoSelection/rules/winRegistry.unit.test.ts
@@ -54,7 +51,6 @@ src/test/interpreters/autoSelection/rules/currentPath.unit.test.ts
5451
src/test/interpreters/autoSelection/rules/system.unit.test.ts
5552
src/test/interpreters/virtualEnvManager.unit.test.ts
5653
src/test/interpreters/pythonPathUpdaterFactory.unit.test.ts
57-
src/test/interpreters/interpreterService.unit.test.ts
5854
src/test/interpreters/activation/service.unit.test.ts
5955
src/test/interpreters/activation/wrapperEnvironmentActivationService.unit.test.ts
6056
src/test/interpreters/helpers.unit.test.ts
@@ -64,9 +60,6 @@ src/test/interpreters/display.unit.test.ts
6460

6561
src/test/configuration/interpreterSelector/interpreterSelector.unit.test.ts
6662

67-
src/test/install/channelManager.channels.test.ts
68-
src/test/install/channelManager.messages.test.ts
69-
7063
src/test/terminals/serviceRegistry.unit.test.ts
7164
src/test/terminals/activation.unit.test.ts
7265
src/test/terminals/codeExecution/terminalCodeExec.unit.test.ts
@@ -176,7 +169,6 @@ src/test/testing/display/picker.unit.test.ts
176169

177170
src/test/common/exitCIAfterTestReporter.ts
178171
src/test/common/crypto.unit.test.ts
179-
src/test/common/configuration/service.unit.test.ts
180172
src/test/common/net/fileDownloader.unit.test.ts
181173
src/test/common/net/httpClient.unit.test.ts
182174
src/test/common/terminals/activator/index.unit.test.ts
@@ -271,17 +263,14 @@ src/test/telemetry/importTracker.unit.test.ts
271263
src/test/telemetry/envFileTelemetry.unit.test.ts
272264

273265
src/test/linters/pylint.unit.test.ts
274-
src/test/linters/lint.provider.test.ts
275266
src/test/linters/lint.unit.test.ts
276267
src/test/linters/linter.availability.unit.test.ts
277268
src/test/linters/common.ts
278269
src/test/linters/lintengine.test.ts
279270
src/test/linters/lint.multilinter.test.ts
280271
src/test/linters/lint.test.ts
281272
src/test/linters/linterinfo.unit.test.ts
282-
src/test/linters/pylint.test.ts
283273
src/test/linters/lint.manager.unit.test.ts
284-
src/test/linters/lint.args.test.ts
285274
src/test/linters/linterCommands.unit.test.ts
286275
src/test/linters/linterManager.unit.test.ts
287276

@@ -321,22 +310,19 @@ src/client/interpreter/configuration/pythonPathUpdaterServiceFactory.ts
321310
src/client/interpreter/configuration/services/globalUpdaterService.ts
322311
src/client/interpreter/configuration/services/workspaceUpdaterService.ts
323312
src/client/interpreter/configuration/services/workspaceFolderUpdaterService.ts
324-
src/client/interpreter/serviceRegistry.ts
325313
src/client/interpreter/helpers.ts
326314
src/client/interpreter/virtualEnvs/condaInheritEnvPrompt.ts
327315
src/client/interpreter/virtualEnvs/types.ts
328316
src/client/interpreter/virtualEnvs/index.ts
329317
src/client/interpreter/autoSelection/interpreterSecurity/interpreterSecurityStorage.ts
330318
src/client/interpreter/autoSelection/interpreterSecurity/interpreterEvaluation.ts
331319
src/client/interpreter/autoSelection/interpreterSecurity/interpreterSecurityService.ts
332-
src/client/interpreter/autoSelection/proxy.ts
333320
src/client/interpreter/autoSelection/rules/baseRule.ts
334321
src/client/interpreter/autoSelection/rules/winRegistry.ts
335322
src/client/interpreter/autoSelection/rules/settings.ts
336323
src/client/interpreter/autoSelection/rules/currentPath.ts
337324
src/client/interpreter/autoSelection/rules/cached.ts
338325
src/client/interpreter/autoSelection/rules/system.ts
339-
src/client/interpreter/autoSelection/index.ts
340326
src/client/interpreter/activation/wrapperEnvironmentActivationService.ts
341327
src/client/interpreter/activation/terminalEnvironmentActivationService.ts
342328
src/client/interpreter/activation/preWarmVariables.ts
@@ -732,7 +718,6 @@ src/test/startPage/mockCommandManager.ts
732718
src/test/startPage/mockDocument.ts
733719
src/test/startPage/mockDocumentManager.ts
734720
src/test/startPage/mockExtensions.ts
735-
src/test/startPage/mockPythonSettings.ts
736721
src/test/startPage/mockTextEditor.ts
737722
src/test/startPage/mockWorkspaceConfig.ts
738723
src/test/startPage/mockWorkspaceFolder.ts

src/client/common/configSettings.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from 'vscode';
1616
import { LanguageServerType } from '../activation/types';
1717
import './extensions';
18-
import { IInterpreterAutoSeletionProxyService, IInterpreterSecurityService } from '../interpreter/autoSelection/types';
18+
import { IInterpreterAutoSelectionProxyService, IInterpreterSecurityService } from '../interpreter/autoSelection/types';
1919
import { LogLevel } from '../logging/levels';
2020
import { sendTelemetryEvent } from '../telemetry';
2121
import { EventName } from '../telemetry/constants';
@@ -159,7 +159,7 @@ export class PythonSettings implements IPythonSettings {
159159

160160
constructor(
161161
workspaceFolder: Resource,
162-
private readonly interpreterAutoSelectionService: IInterpreterAutoSeletionProxyService,
162+
private readonly interpreterAutoSelectionService: IInterpreterAutoSelectionProxyService,
163163
workspace?: IWorkspaceService,
164164
private readonly experimentsManager?: IExperimentsManager,
165165
private readonly interpreterPathService?: IInterpreterPathService,
@@ -173,7 +173,7 @@ export class PythonSettings implements IPythonSettings {
173173

174174
public static getInstance(
175175
resource: Uri | undefined,
176-
interpreterAutoSelectionService: IInterpreterAutoSeletionProxyService,
176+
interpreterAutoSelectionService: IInterpreterAutoSelectionProxyService,
177177
workspace?: IWorkspaceService,
178178
experimentsManager?: IExperimentsManager,
179179
interpreterPathService?: IInterpreterPathService,

src/client/common/configuration/service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { inject, injectable } from 'inversify';
55
import { ConfigurationTarget, Uri, WorkspaceConfiguration } from 'vscode';
66
import {
7-
IInterpreterAutoSeletionProxyService,
7+
IInterpreterAutoSelectionProxyService,
88
IInterpreterSecurityService,
99
} from '../../interpreter/autoSelection/types';
1010
import { IServiceContainer } from '../../ioc/types';
@@ -29,8 +29,8 @@ export class ConfigurationService implements IConfigurationService {
2929
}
3030

3131
public getSettings(resource?: Uri): IPythonSettings {
32-
const InterpreterAutoSelectionService = this.serviceContainer.get<IInterpreterAutoSeletionProxyService>(
33-
IInterpreterAutoSeletionProxyService,
32+
const InterpreterAutoSelectionService = this.serviceContainer.get<IInterpreterAutoSelectionProxyService>(
33+
IInterpreterAutoSelectionProxyService,
3434
);
3535
const interpreterPathService = this.serviceContainer.get<IInterpreterPathService>(IInterpreterPathService);
3636
const experiments = this.serviceContainer.get<IExperimentsManager>(IExperimentsManager);

src/client/interpreter/autoSelection/index.ts

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
AutoSelectionRule,
2020
IInterpreterAutoSelectionRule,
2121
IInterpreterAutoSelectionService,
22-
IInterpreterAutoSeletionProxyService,
22+
IInterpreterAutoSelectionProxyService,
2323
IInterpreterSecurityService,
2424
} from './types';
2525

@@ -29,10 +29,15 @@ const workspacePathNameForGlobalWorkspaces = '';
2929
@injectable()
3030
export class InterpreterAutoSelectionService implements IInterpreterAutoSelectionService {
3131
protected readonly autoSelectedWorkspacePromises = new Map<string, Deferred<void>>();
32+
3233
private readonly didAutoSelectedInterpreterEmitter = new EventEmitter<void>();
34+
3335
private readonly autoSelectedInterpreterByWorkspace = new Map<string, PythonEnvironment | undefined>();
36+
3437
private globallyPreferredInterpreter!: IPersistentState<PythonEnvironment | undefined>;
38+
3539
private readonly rules: IInterpreterAutoSelectionRule[] = [];
40+
3641
constructor(
3742
@inject(IWorkspaceService) private readonly workspaceService: IWorkspaceService,
3843
@inject(IPersistentStateFactory) private readonly stateFactory: IPersistentStateFactory,
@@ -55,7 +60,7 @@ export class InterpreterAutoSelectionService implements IInterpreterAutoSelectio
5560
@inject(IInterpreterAutoSelectionRule)
5661
@named(AutoSelectionRule.workspaceVirtualEnvs)
5762
workspaceInterpreter: IInterpreterAutoSelectionRule,
58-
@inject(IInterpreterAutoSeletionProxyService) proxy: IInterpreterAutoSeletionProxyService,
63+
@inject(IInterpreterAutoSelectionProxyService) proxy: IInterpreterAutoSelectionProxyService,
5964
@inject(IInterpreterHelper) private readonly interpreterHelper: IInterpreterHelper,
6065
@inject(IInterpreterSecurityService) private readonly interpreterSecurityService: IInterpreterSecurityService,
6166
) {
@@ -95,6 +100,7 @@ export class InterpreterAutoSelectionService implements IInterpreterAutoSelectio
95100
currentPathInterpreter.setNextRule(winRegInterpreter);
96101
winRegInterpreter.setNextRule(systemInterpreter);
97102
}
103+
98104
@captureTelemetry(EventName.PYTHON_INTERPRETER_AUTO_SELECTION, { rule: AutoSelectionRule.all }, true)
99105
public async autoSelectInterpreter(resource: Resource): Promise<void> {
100106
const key = this.getWorkspacePathKey(resource);
@@ -110,9 +116,11 @@ export class InterpreterAutoSelectionService implements IInterpreterAutoSelectio
110116
}
111117
return this.autoSelectedWorkspacePromises.get(key)!.promise;
112118
}
119+
113120
public get onDidChangeAutoSelectedInterpreter(): Event<void> {
114121
return this.didAutoSelectedInterpreterEmitter.event;
115122
}
123+
116124
public getAutoSelectedInterpreter(resource: Resource): PythonEnvironment | undefined {
117125
// Do not execute anycode other than fetching fromm a property.
118126
// This method gets invoked from settings class, and this class in turn uses classes that relies on settings.
@@ -135,20 +143,27 @@ export class InterpreterAutoSelectionService implements IInterpreterAutoSelectio
135143

136144
return this.globallyPreferredInterpreter.value;
137145
}
138-
public async setWorkspaceInterpreter(resource: Uri, interpreter: PythonEnvironment | undefined) {
146+
147+
public async setWorkspaceInterpreter(resource: Uri, interpreter: PythonEnvironment | undefined): Promise<void> {
139148
await this.storeAutoSelectedInterpreter(resource, interpreter);
140149
}
141-
public async setGlobalInterpreter(interpreter: PythonEnvironment) {
150+
151+
public async setGlobalInterpreter(interpreter: PythonEnvironment): Promise<void> {
142152
await this.storeAutoSelectedInterpreter(undefined, interpreter);
143153
}
144-
protected async clearWorkspaceStoreIfInvalid(resource: Resource) {
154+
155+
protected async clearWorkspaceStoreIfInvalid(resource: Resource): Promise<void> {
145156
const stateStore = this.getWorkspaceState(resource);
146157
if (stateStore && stateStore.value && !(await this.fs.fileExists(stateStore.value.path))) {
147158
sendTelemetryEvent(EventName.PYTHON_INTERPRETER_AUTO_SELECTION, {}, { interpreterMissing: true });
148159
await stateStore.updateValue(undefined);
149160
}
150161
}
151-
protected async storeAutoSelectedInterpreter(resource: Resource, interpreter: PythonEnvironment | undefined) {
162+
163+
protected async storeAutoSelectedInterpreter(
164+
resource: Resource,
165+
interpreter: PythonEnvironment | undefined,
166+
): Promise<void> {
152167
const workspaceFolderPath = this.getWorkspacePathKey(resource);
153168
if (workspaceFolderPath === workspacePathNameForGlobalWorkspaces) {
154169
// Update store only if this version is better.
@@ -173,7 +188,8 @@ export class InterpreterAutoSelectionService implements IInterpreterAutoSelectio
173188
this.autoSelectedInterpreterByWorkspace.set(workspaceFolderPath, interpreter);
174189
}
175190
}
176-
protected async initializeStore(resource: Resource) {
191+
192+
protected async initializeStore(resource: Resource): Promise<void> {
177193
const workspaceFolderPath = this.getWorkspacePathKey(resource);
178194
// Since we're initializing for this resource,
179195
// Ensure any cached information for this workspace have been removed.
@@ -183,6 +199,7 @@ export class InterpreterAutoSelectionService implements IInterpreterAutoSelectio
183199
}
184200
await this.clearStoreIfFileIsInvalid();
185201
}
202+
186203
private async clearStoreIfFileIsInvalid() {
187204
this.globallyPreferredInterpreter = this.stateFactory.createGlobalPersistentState<
188205
PythonEnvironment | undefined
@@ -194,15 +211,17 @@ export class InterpreterAutoSelectionService implements IInterpreterAutoSelectio
194211
await this.globallyPreferredInterpreter.updateValue(undefined);
195212
}
196213
}
214+
197215
private getWorkspacePathKey(resource: Resource): string {
198216
return this.workspaceService.getWorkspaceFolderIdentifier(resource, workspacePathNameForGlobalWorkspaces);
199217
}
218+
200219
private getWorkspaceState(resource: Resource): undefined | IPersistentState<PythonEnvironment | undefined> {
201220
const workspaceUri = this.interpreterHelper.getActiveWorkspaceUri(resource);
202-
if (!workspaceUri) {
203-
return;
221+
if (workspaceUri) {
222+
const key = `autoSelectedWorkspacePythonInterpreter-${workspaceUri.folderUri.fsPath}`;
223+
return this.stateFactory.createWorkspacePersistentState(key, undefined);
204224
}
205-
const key = `autoSelectedWorkspacePythonInterpreter-${workspaceUri.folderUri.fsPath}`;
206-
return this.stateFactory.createWorkspacePersistentState(key, undefined);
225+
return undefined;
207226
}
208227
}

src/client/interpreter/autoSelection/proxy.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,31 @@ import { inject, injectable } from 'inversify';
77
import { Event, EventEmitter, Uri } from 'vscode';
88
import { IAsyncDisposableRegistry, IDisposableRegistry, Resource } from '../../common/types';
99
import { PythonEnvironment } from '../../pythonEnvironments/info';
10-
import { IInterpreterAutoSeletionProxyService } from './types';
10+
import { IInterpreterAutoSelectionProxyService } from './types';
1111

1212
@injectable()
13-
export class InterpreterAutoSeletionProxyService implements IInterpreterAutoSeletionProxyService {
13+
export class InterpreterAutoSelectionProxyService implements IInterpreterAutoSelectionProxyService {
1414
private readonly didAutoSelectedInterpreterEmitter = new EventEmitter<void>();
15-
private instance?: IInterpreterAutoSeletionProxyService;
15+
16+
private instance?: IInterpreterAutoSelectionProxyService;
17+
1618
constructor(@inject(IDisposableRegistry) private readonly disposables: IAsyncDisposableRegistry) {}
17-
public registerInstance(instance: IInterpreterAutoSeletionProxyService): void {
19+
20+
public registerInstance(instance: IInterpreterAutoSelectionProxyService): void {
1821
this.instance = instance;
1922
this.disposables.push(
2023
this.instance.onDidChangeAutoSelectedInterpreter(() => this.didAutoSelectedInterpreterEmitter.fire()),
2124
);
2225
}
26+
2327
public get onDidChangeAutoSelectedInterpreter(): Event<void> {
2428
return this.didAutoSelectedInterpreterEmitter.event;
2529
}
30+
2631
public getAutoSelectedInterpreter(resource: Resource): PythonEnvironment | undefined {
2732
return this.instance ? this.instance.getAutoSelectedInterpreter(resource) : undefined;
2833
}
34+
2935
public async setWorkspaceInterpreter(resource: Uri, interpreter: PythonEnvironment | undefined): Promise<void> {
3036
return this.instance ? this.instance.setWorkspaceInterpreter(resource, interpreter) : undefined;
3137
}

src/client/interpreter/autoSelection/types.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { IExtensionSingleActivationService } from '../../activation/types';
88
import { IPersistentState, Resource } from '../../common/types';
99
import { PythonEnvironment } from '../../pythonEnvironments/info';
1010

11-
export const IInterpreterAutoSeletionProxyService = Symbol('IInterpreterAutoSeletionProxyService');
11+
export const IInterpreterAutoSelectionProxyService = Symbol('IInterpreterAutoSelectionProxyService');
1212
/**
1313
* Interface similar to IInterpreterAutoSelectionService, to avoid chickn n egg situation.
1414
* Do we get python path from config first or get auto selected interpreter first!?
@@ -17,17 +17,17 @@ export const IInterpreterAutoSeletionProxyService = Symbol('IInterpreterAutoSele
1717
* Solution - Use a proxy that does nothing first, but later the real instance is injected.
1818
*
1919
* @export
20-
* @interface IInterpreterAutoSeletionProxyService
20+
* @interface IInterpreterAutoSelectionProxyService
2121
*/
22-
export interface IInterpreterAutoSeletionProxyService {
22+
export interface IInterpreterAutoSelectionProxyService {
2323
readonly onDidChangeAutoSelectedInterpreter: Event<void>;
2424
getAutoSelectedInterpreter(resource: Resource): PythonEnvironment | undefined;
25-
registerInstance?(instance: IInterpreterAutoSeletionProxyService): void;
25+
registerInstance?(instance: IInterpreterAutoSelectionProxyService): void;
2626
setWorkspaceInterpreter(resource: Uri, interpreter: PythonEnvironment | undefined): Promise<void>;
2727
}
2828

2929
export const IInterpreterAutoSelectionService = Symbol('IInterpreterAutoSelectionService');
30-
export interface IInterpreterAutoSelectionService extends IInterpreterAutoSeletionProxyService {
30+
export interface IInterpreterAutoSelectionService extends IInterpreterAutoSelectionProxyService {
3131
readonly onDidChangeAutoSelectedInterpreter: Event<void>;
3232
autoSelectInterpreter(resource: Resource): Promise<void>;
3333
getAutoSelectedInterpreter(resource: Resource): PythonEnvironment | undefined;

src/client/interpreter/serviceRegistry.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { InterpreterAutoSelectionService } from './autoSelection/index';
1313
import { InterpreterEvaluation } from './autoSelection/interpreterSecurity/interpreterEvaluation';
1414
import { InterpreterSecurityService } from './autoSelection/interpreterSecurity/interpreterSecurityService';
1515
import { InterpreterSecurityStorage } from './autoSelection/interpreterSecurity/interpreterSecurityStorage';
16-
import { InterpreterAutoSeletionProxyService } from './autoSelection/proxy';
16+
import { InterpreterAutoSelectionProxyService } from './autoSelection/proxy';
1717
import { CachedInterpretersAutoSelectionRule } from './autoSelection/rules/cached';
1818
import { CurrentPathInterpretersAutoSelectionRule } from './autoSelection/rules/currentPath';
1919
import { SettingsInterpretersAutoSelectionRule } from './autoSelection/rules/settings';
@@ -24,7 +24,7 @@ import {
2424
AutoSelectionRule,
2525
IInterpreterAutoSelectionRule,
2626
IInterpreterAutoSelectionService,
27-
IInterpreterAutoSeletionProxyService,
27+
IInterpreterAutoSelectionProxyService,
2828
IInterpreterEvaluation,
2929
IInterpreterSecurityService,
3030
IInterpreterSecurityStorage,
@@ -61,12 +61,12 @@ import { VirtualEnvironmentPrompt } from './virtualEnvs/virtualEnvPrompt';
6161

6262
/**
6363
* Register all the new types inside this method.
64-
* This method is created for testing purposes. Registers all interpreter types except `IInterpreterAutoSeletionProxyService`, `IEnvironmentActivationService`.
64+
* This method is created for testing purposes. Registers all interpreter types except `IInterpreterAutoSelectionProxyService`, `IEnvironmentActivationService`.
6565
* See use case in `src\test\serviceRegistry.ts` for details
6666
* @param serviceManager
6767
*/
6868

69-
export function registerInterpreterTypes(serviceManager: IServiceManager) {
69+
export function registerInterpreterTypes(serviceManager: IServiceManager): void {
7070
serviceManager.addSingleton<IExtensionSingleActivationService>(
7171
IExtensionSingleActivationService,
7272
InterpreterSecurityStorage,
@@ -161,11 +161,11 @@ export function registerInterpreterTypes(serviceManager: IServiceManager) {
161161
);
162162
}
163163

164-
export function registerTypes(serviceManager: IServiceManager) {
164+
export function registerTypes(serviceManager: IServiceManager): void {
165165
registerInterpreterTypes(serviceManager);
166-
serviceManager.addSingleton<IInterpreterAutoSeletionProxyService>(
167-
IInterpreterAutoSeletionProxyService,
168-
InterpreterAutoSeletionProxyService,
166+
serviceManager.addSingleton<IInterpreterAutoSelectionProxyService>(
167+
IInterpreterAutoSelectionProxyService,
168+
InterpreterAutoSelectionProxyService,
169169
);
170170
serviceManager.addSingleton<IEnvironmentActivationService>(
171171
EnvironmentActivationService,

0 commit comments

Comments
 (0)