Skip to content
Merged
Changes from 1 commit
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
52 changes: 29 additions & 23 deletions src/features/interpreterSelection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,32 +106,38 @@ async function resolvePriorityChainCore(
// PRIORITY 3: User-configured python.defaultInterpreterPath
const userInterpreterPath = getUserConfiguredSetting<string>('python', 'defaultInterpreterPath', scope);
if (userInterpreterPath) {
const expandedInterpreterPath = resolveVariables(userInterpreterPath, scope);
if (expandedInterpreterPath.includes('${')) {
traceWarn(
`${logPrefix} defaultInterpreterPath '${userInterpreterPath}' contains unresolved variables, falling back to auto-discovery`,
if (!scope && userInterpreterPath.includes('${workspaceFolder}')) {
traceVerbose(
Copy link
Copy Markdown
Member

@karthiknadig karthiknadig Mar 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be we should explicitly return undefined here (after logging)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent was to skip ${workspaceFolder}-eval during global resolution & just fall through to Priority 4 auto-discovery w/o recording an error, rather than treating it as unresolved.

`${logPrefix} Skipping workspace-scoped defaultInterpreterPath during global resolution: ${userInterpreterPath}`,
);
const error: SettingResolutionError = {
setting: 'defaultInterpreterPath',
configuredValue: userInterpreterPath,
reason: l10n.t('Path contains unresolved variables'),
};
errors.push(error);
} else {
const resolved = await tryResolveInterpreterPath(nativeFinder, api, expandedInterpreterPath, envManagers);
if (resolved) {
traceVerbose(`${logPrefix} Priority 3: Using defaultInterpreterPath: ${userInterpreterPath}`);
return { result: resolved, errors };
const expandedInterpreterPath = resolveVariables(userInterpreterPath, scope);
if (expandedInterpreterPath.includes('${')) {
traceWarn(
`${logPrefix} defaultInterpreterPath '${userInterpreterPath}' contains unresolved variables, falling back to auto-discovery`,
);
const error: SettingResolutionError = {
setting: 'defaultInterpreterPath',
configuredValue: userInterpreterPath,
reason: l10n.t('Path contains unresolved variables'),
};
errors.push(error);
} else {
const resolved = await tryResolveInterpreterPath(nativeFinder, api, expandedInterpreterPath, envManagers);
if (resolved) {
traceVerbose(`${logPrefix} Priority 3: Using defaultInterpreterPath: ${userInterpreterPath}`);
return { result: resolved, errors };
}
const error: SettingResolutionError = {
setting: 'defaultInterpreterPath',
configuredValue: userInterpreterPath,
reason: `Could not resolve interpreter path '${userInterpreterPath}'`,
};
errors.push(error);
traceWarn(
`${logPrefix} defaultInterpreterPath '${userInterpreterPath}' unresolvable, falling back to auto-discovery`,
);
}
const error: SettingResolutionError = {
setting: 'defaultInterpreterPath',
configuredValue: userInterpreterPath,
reason: `Could not resolve interpreter path '${userInterpreterPath}'`,
};
errors.push(error);
traceWarn(
`${logPrefix} defaultInterpreterPath '${userInterpreterPath}' unresolvable, falling back to auto-discovery`,
);
}
}

Expand Down