diff --git a/src/client/activation/languageClientMiddlewareBase.ts b/src/client/activation/languageClientMiddlewareBase.ts index 7c6b3e80a643..5f7b6fa72656 100644 --- a/src/client/activation/languageClientMiddlewareBase.ts +++ b/src/client/activation/languageClientMiddlewareBase.ts @@ -13,10 +13,10 @@ import { import { ConfigurationItem } from 'vscode-languageserver-protocol'; import { HiddenFilePrefix } from '../common/constants'; -import { IConfigurationService } from '../common/types'; import { createDeferred, isThenable } from '../common/utils/async'; import { StopWatch } from '../common/utils/stopWatch'; import { IEnvironmentVariablesProvider } from '../common/variables/types'; +import { IInterpreterService } from '../interpreter/contracts'; import { IServiceContainer } from '../ioc/types'; import { EventName } from '../telemetry/constants'; import { LanguageServerType } from './types'; @@ -66,7 +66,7 @@ export class LanguageClientMiddlewareBase implements Middleware { return next(params, token); } - const configService = this.serviceContainer.get(IConfigurationService); + const interpreterService = this.serviceContainer.get(IInterpreterService); const envService = this.serviceContainer.get(IEnvironmentVariablesProvider); let settings = next(params, token); @@ -87,9 +87,10 @@ export class LanguageClientMiddlewareBase implements Middleware { const settingDict: LSPObject & { pythonPath: string; _envPYTHONPATH: string } = settings[ i ] as LSPObject & { pythonPath: string; _envPYTHONPATH: string }; - settingDict.pythonPath = - (await this.getPythonPathOverride(uri)) ?? configService.getSettings(uri).pythonPath; + (await this.getPythonPathOverride(uri)) ?? + (await interpreterService.getActiveInterpreter(uri))?.path ?? + 'python'; const env = await envService.getEnvironmentVariables(uri); const envPYTHONPATH = env.PYTHONPATH; diff --git a/src/client/interpreter/configuration/pythonPathUpdaterService.ts b/src/client/interpreter/configuration/pythonPathUpdaterService.ts index ae2c92eada5b..9b9cc26f845f 100644 --- a/src/client/interpreter/configuration/pythonPathUpdaterService.ts +++ b/src/client/interpreter/configuration/pythonPathUpdaterService.ts @@ -1,5 +1,4 @@ import { inject, injectable } from 'inversify'; -import * as path from 'path'; import { ConfigurationTarget, l10n, Uri, window } from 'vscode'; import { StopWatch } from '../../common/utils/stopWatch'; import { SystemVariables } from '../../common/variables/systemVariables'; @@ -28,7 +27,7 @@ export class PythonPathUpdaterService implements IPythonPathUpdaterServiceManage const pythonPathUpdater = this.getPythonUpdaterService(configTarget, wkspace); let failed = false; try { - await pythonPathUpdater.updatePythonPath(pythonPath ? path.normalize(pythonPath) : undefined); + await pythonPathUpdater.updatePythonPath(pythonPath); } catch (err) { failed = true; const reason = err as Error;