@@ -106,32 +106,38 @@ async function resolvePriorityChainCore(
106106 // PRIORITY 3: User-configured python.defaultInterpreterPath
107107 const userInterpreterPath = getUserConfiguredSetting < string > ( 'python' , 'defaultInterpreterPath' , scope ) ;
108108 if ( userInterpreterPath ) {
109- const expandedInterpreterPath = resolveVariables ( userInterpreterPath , scope ) ;
110- if ( expandedInterpreterPath . includes ( '${' ) ) {
111- traceWarn (
112- `${ logPrefix } defaultInterpreterPath '${ userInterpreterPath } ' contains unresolved variables, falling back to auto-discovery` ,
109+ if ( ! scope && userInterpreterPath . includes ( '${workspaceFolder}' ) ) {
110+ traceVerbose (
111+ `${ logPrefix } Skipping workspace-scoped defaultInterpreterPath during global resolution: ${ userInterpreterPath } ` ,
113112 ) ;
114- const error : SettingResolutionError = {
115- setting : 'defaultInterpreterPath' ,
116- configuredValue : userInterpreterPath ,
117- reason : l10n . t ( 'Path contains unresolved variables' ) ,
118- } ;
119- errors . push ( error ) ;
120113 } else {
121- const resolved = await tryResolveInterpreterPath ( nativeFinder , api , expandedInterpreterPath , envManagers ) ;
122- if ( resolved ) {
123- traceVerbose ( `${ logPrefix } Priority 3: Using defaultInterpreterPath: ${ userInterpreterPath } ` ) ;
124- return { result : resolved , errors } ;
114+ const expandedInterpreterPath = resolveVariables ( userInterpreterPath , scope ) ;
115+ if ( expandedInterpreterPath . includes ( '${' ) ) {
116+ traceWarn (
117+ `${ logPrefix } defaultInterpreterPath '${ userInterpreterPath } ' contains unresolved variables, falling back to auto-discovery` ,
118+ ) ;
119+ const error : SettingResolutionError = {
120+ setting : 'defaultInterpreterPath' ,
121+ configuredValue : userInterpreterPath ,
122+ reason : l10n . t ( 'Path contains unresolved variables' ) ,
123+ } ;
124+ errors . push ( error ) ;
125+ } else {
126+ const resolved = await tryResolveInterpreterPath ( nativeFinder , api , expandedInterpreterPath , envManagers ) ;
127+ if ( resolved ) {
128+ traceVerbose ( `${ logPrefix } Priority 3: Using defaultInterpreterPath: ${ userInterpreterPath } ` ) ;
129+ return { result : resolved , errors } ;
130+ }
131+ const error : SettingResolutionError = {
132+ setting : 'defaultInterpreterPath' ,
133+ configuredValue : userInterpreterPath ,
134+ reason : `Could not resolve interpreter path '${ userInterpreterPath } '` ,
135+ } ;
136+ errors . push ( error ) ;
137+ traceWarn (
138+ `${ logPrefix } defaultInterpreterPath '${ userInterpreterPath } ' unresolvable, falling back to auto-discovery` ,
139+ ) ;
125140 }
126- const error : SettingResolutionError = {
127- setting : 'defaultInterpreterPath' ,
128- configuredValue : userInterpreterPath ,
129- reason : `Could not resolve interpreter path '${ userInterpreterPath } '` ,
130- } ;
131- errors . push ( error ) ;
132- traceWarn (
133- `${ logPrefix } defaultInterpreterPath '${ userInterpreterPath } ' unresolvable, falling back to auto-discovery` ,
134- ) ;
135141 }
136142 }
137143
0 commit comments