Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 1 addition & 31 deletions src/client/envExt/api.internal.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { EventEmitter, Terminal, Uri, Disposable, ConfigurationTarget } from 'vscode';
import { EventEmitter, Terminal, Uri, Disposable } from 'vscode';
import { getExtension } from '../common/vscodeApis/extensionsApi';
import {
GetEnvironmentScope,
Expand All @@ -13,7 +13,6 @@ import {
DidChangeEnvironmentEventArgs,
} from './types';
import { executeCommand } from '../common/vscodeApis/commandApis';
import { IInterpreterPathService } from '../common/types';
import { getConfiguration } from '../common/vscodeApis/workspaceApis';

export const ENVS_EXTENSION_ID = 'ms-python.vscode-python-envs';
Expand Down Expand Up @@ -128,32 +127,3 @@ export async function clearCache(): Promise<void> {
await executeCommand('python-envs.clearCache');
}
}

export function registerEnvExtFeatures(
disposables: Disposable[],
interpreterPathService: IInterpreterPathService,
): void {
if (useEnvExtension()) {
disposables.push(
onDidChangeEnvironmentEnvExt(async (e: DidChangeEnvironmentEventArgs) => {
const previousPath = interpreterPathService.get(e.uri);

if (previousPath !== e.new?.environmentPath.fsPath) {
if (e.uri) {
await interpreterPathService.update(
e.uri,
ConfigurationTarget.WorkspaceFolder,
e.new?.environmentPath.fsPath,
);
} else {
await interpreterPathService.update(
undefined,
ConfigurationTarget.Global,
e.new?.environmentPath.fsPath,
);
}
}
}),
);
}
}
14 changes: 1 addition & 13 deletions src/client/extensionActivation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,7 @@ import { IApplicationEnvironment, ICommandManager, IWorkspaceService } from './c
import { Commands, PYTHON_LANGUAGE, UseProposedApi } from './common/constants';
import { registerTypes as installerRegisterTypes } from './common/installer/serviceRegistry';
import { IFileSystem } from './common/platform/types';
import {
IConfigurationService,
IDisposableRegistry,
IExtensions,
IInterpreterPathService,
ILogOutputChannel,
IPathUtils,
} from './common/types';
import { IConfigurationService, IDisposableRegistry, IExtensions, ILogOutputChannel, IPathUtils } from './common/types';
import { noop } from './common/utils/misc';
import { registerTypes as debugConfigurationRegisterTypes } from './debugger/extension/serviceRegistry';
import { IDebugConfigurationService } from './debugger/extension/types';
Expand Down Expand Up @@ -55,7 +48,6 @@ import { registerTriggerForTerminalREPL } from './terminals/codeExecution/termin
import { registerPythonStartup } from './terminals/pythonStartup';
import { registerPixiFeatures } from './pythonEnvironments/common/environmentManagers/pixi';
import { registerCustomTerminalLinkProvider } from './terminals/pythonStartupLinkProvider';
import { registerEnvExtFeatures } from './envExt/api.internal';

export async function activateComponents(
// `ext` is passed to any extra activation funcs.
Expand Down Expand Up @@ -95,13 +87,9 @@ export function activateFeatures(ext: ExtensionState, _components: Components):
const interpreterQuickPick: IInterpreterQuickPick = ext.legacyIOC.serviceContainer.get<IInterpreterQuickPick>(
IInterpreterQuickPick,
);
const interpreterPathService: IInterpreterPathService = ext.legacyIOC.serviceContainer.get<IInterpreterPathService>(
IInterpreterPathService,
);
const interpreterService: IInterpreterService = ext.legacyIOC.serviceContainer.get<IInterpreterService>(
IInterpreterService,
);
registerEnvExtFeatures(ext.disposables, interpreterPathService);
const pathUtils = ext.legacyIOC.serviceContainer.get<IPathUtils>(IPathUtils);
registerPixiFeatures(ext.disposables);
registerAllCreateEnvironmentFeatures(
Expand Down