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
14 changes: 13 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ import { registerSystemPythonFeatures } from './managers/builtin/main';
import { SysPythonManager } from './managers/builtin/sysPythonManager';
import {
createNativePythonFinder,
clearCacheDirectory,
getNativePythonToolsPathAndSource,
getNativePythonToolsVersion,
NativePythonFinder,
Expand Down Expand Up @@ -246,6 +247,8 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
const terminalEnvVarInjector = new TerminalEnvVarInjector(context.environmentVariableCollection, envVarManager);
context.subscriptions.push(terminalEnvVarInjector);

let sharedNativeFinder: NativePythonFinder | undefined;

context.subscriptions.push(
shellStartupVarsMgr,
registerCompletionProvider(envManagers),
Expand Down Expand Up @@ -390,7 +393,15 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
commands.registerCommand('python-envs.clearCache', async () => {
await clearPersistentState();
await envManagers.clearCache(undefined);
await clearShellProfileCache(shellStartupProviders);
try {
if (sharedNativeFinder) {
await sharedNativeFinder.clearCache();
} else {
await clearCacheDirectory(context);
}
} finally {
await clearShellProfileCache(shellStartupProviders);
}
}),
...(isInlineScriptsFeatureEnabled()
? [
Expand Down Expand Up @@ -657,6 +668,7 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
throw petError;
}
context.subscriptions.push(nativeFinder);
sharedNativeFinder = nativeFinder;
const sysMgr = new SysPythonManager(nativeFinder, api, outputChannel);
sysPythonManager.resolve(sysMgr);
// Each manager registers independently — one failure must not block the others.
Expand Down
Loading
Loading