Skip to content

Commit 0b477a3

Browse files
authored
remove method to update defaultInterpreterPath on env ext environment change (#25736)
fixes microsoft/vscode-python-environments#1082
1 parent 1965191 commit 0b477a3

File tree

2 files changed

+2
-44
lines changed

2 files changed

+2
-44
lines changed

src/client/envExt/api.internal.ts

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
import { EventEmitter, Terminal, Uri, Disposable, ConfigurationTarget } from 'vscode';
4+
import { EventEmitter, Terminal, Uri, Disposable } from 'vscode';
55
import { getExtension } from '../common/vscodeApis/extensionsApi';
66
import {
77
GetEnvironmentScope,
@@ -13,7 +13,6 @@ import {
1313
DidChangeEnvironmentEventArgs,
1414
} from './types';
1515
import { executeCommand } from '../common/vscodeApis/commandApis';
16-
import { IInterpreterPathService } from '../common/types';
1716
import { getConfiguration } from '../common/vscodeApis/workspaceApis';
1817

1918
export const ENVS_EXTENSION_ID = 'ms-python.vscode-python-envs';
@@ -128,32 +127,3 @@ export async function clearCache(): Promise<void> {
128127
await executeCommand('python-envs.clearCache');
129128
}
130129
}
131-
132-
export function registerEnvExtFeatures(
133-
disposables: Disposable[],
134-
interpreterPathService: IInterpreterPathService,
135-
): void {
136-
if (useEnvExtension()) {
137-
disposables.push(
138-
onDidChangeEnvironmentEnvExt(async (e: DidChangeEnvironmentEventArgs) => {
139-
const previousPath = interpreterPathService.get(e.uri);
140-
141-
if (previousPath !== e.new?.environmentPath.fsPath) {
142-
if (e.uri) {
143-
await interpreterPathService.update(
144-
e.uri,
145-
ConfigurationTarget.WorkspaceFolder,
146-
e.new?.environmentPath.fsPath,
147-
);
148-
} else {
149-
await interpreterPathService.update(
150-
undefined,
151-
ConfigurationTarget.Global,
152-
e.new?.environmentPath.fsPath,
153-
);
154-
}
155-
}
156-
}),
157-
);
158-
}
159-
}

src/client/extensionActivation.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,7 @@ import { IApplicationEnvironment, ICommandManager, IWorkspaceService } from './c
1313
import { Commands, PYTHON_LANGUAGE, UseProposedApi } from './common/constants';
1414
import { registerTypes as installerRegisterTypes } from './common/installer/serviceRegistry';
1515
import { IFileSystem } from './common/platform/types';
16-
import {
17-
IConfigurationService,
18-
IDisposableRegistry,
19-
IExtensions,
20-
IInterpreterPathService,
21-
ILogOutputChannel,
22-
IPathUtils,
23-
} from './common/types';
16+
import { IConfigurationService, IDisposableRegistry, IExtensions, ILogOutputChannel, IPathUtils } from './common/types';
2417
import { noop } from './common/utils/misc';
2518
import { registerTypes as debugConfigurationRegisterTypes } from './debugger/extension/serviceRegistry';
2619
import { IDebugConfigurationService } from './debugger/extension/types';
@@ -55,7 +48,6 @@ import { registerTriggerForTerminalREPL } from './terminals/codeExecution/termin
5548
import { registerPythonStartup } from './terminals/pythonStartup';
5649
import { registerPixiFeatures } from './pythonEnvironments/common/environmentManagers/pixi';
5750
import { registerCustomTerminalLinkProvider } from './terminals/pythonStartupLinkProvider';
58-
import { registerEnvExtFeatures } from './envExt/api.internal';
5951

6052
export async function activateComponents(
6153
// `ext` is passed to any extra activation funcs.
@@ -95,13 +87,9 @@ export function activateFeatures(ext: ExtensionState, _components: Components):
9587
const interpreterQuickPick: IInterpreterQuickPick = ext.legacyIOC.serviceContainer.get<IInterpreterQuickPick>(
9688
IInterpreterQuickPick,
9789
);
98-
const interpreterPathService: IInterpreterPathService = ext.legacyIOC.serviceContainer.get<IInterpreterPathService>(
99-
IInterpreterPathService,
100-
);
10190
const interpreterService: IInterpreterService = ext.legacyIOC.serviceContainer.get<IInterpreterService>(
10291
IInterpreterService,
10392
);
104-
registerEnvExtFeatures(ext.disposables, interpreterPathService);
10593
const pathUtils = ext.legacyIOC.serviceContainer.get<IPathUtils>(IPathUtils);
10694
registerPixiFeatures(ext.disposables);
10795
registerAllCreateEnvironmentFeatures(

0 commit comments

Comments
 (0)