From d66ab3b363f4beec527fe358abc5becf4bb17d4c Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Fri, 7 Jan 2022 00:28:13 +0530 Subject: [PATCH] Do not special case python.pythonPath setting in config service --- src/client/common/configuration/service.ts | 15 +++----------- .../common/configuration/service.unit.test.ts | 20 ------------------- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/src/client/common/configuration/service.ts b/src/client/common/configuration/service.ts index 32e8cc951089..2920e8c14721 100644 --- a/src/client/common/configuration/service.ts +++ b/src/client/common/configuration/service.ts @@ -40,7 +40,6 @@ export class ConfigurationService implements IConfigurationService { resource?: Uri, configTarget?: ConfigurationTarget, ): Promise { - const interpreterPathService = this.serviceContainer.get(IInterpreterPathService); const defaultSetting = { uri: resource, target: configTarget || ConfigurationTarget.WorkspaceFolder, @@ -52,10 +51,7 @@ export class ConfigurationService implements IConfigurationService { configTarget = configTarget || settingsInfo.target; const configSection = this.workspaceService.getConfiguration(section, settingsInfo.uri); - const currentValue = - section === 'python' && setting === 'pythonPath' - ? interpreterPathService.inspect(settingsInfo.uri) - : configSection.inspect(setting); + const currentValue = configSection.inspect(setting); if ( currentValue !== undefined && @@ -65,13 +61,8 @@ export class ConfigurationService implements IConfigurationService { ) { return; } - if (section === 'python' && setting === 'pythonPath') { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - await interpreterPathService.update(settingsInfo.uri, configTarget, value as any); - } else { - await configSection.update(setting, value, configTarget); - await this.verifySetting(configSection, configTarget, setting, value); - } + await configSection.update(setting, value, configTarget); + await this.verifySetting(configSection, configTarget, setting, value); } public async updateSetting( diff --git a/src/test/common/configuration/service.unit.test.ts b/src/test/common/configuration/service.unit.test.ts index 4b55af5f0ba7..19f57173f10a 100644 --- a/src/test/common/configuration/service.unit.test.ts +++ b/src/test/common/configuration/service.unit.test.ts @@ -158,24 +158,4 @@ suite('Configuration Service', () => { workspaceConfig.verifyAll(); }); - - test('If in Deprecate PythonPath experiment & setting to update is `python.pythonPath`, update settings using new API if stored value is not equal to the new value', async () => { - interpreterPathService - .setup((w) => w.inspect(resource)) - - .returns(() => ({ workspaceFolderValue: 'workspaceFolderValue', key: 'setting' })); - interpreterPathService - .setup((w) => w.update(resource, ConfigurationTarget.WorkspaceFolder, 'newWorkspaceFolderValue')) - .returns(() => Promise.resolve()) - .verifiable(TypeMoq.Times.once()); - - await configService.updateSetting( - 'pythonPath', - 'newWorkspaceFolderValue', - resource, - ConfigurationTarget.WorkspaceFolder, - ); - - interpreterPathService.verifyAll(); - }); });