@@ -28,7 +28,7 @@ import {
2828 onDidChangeTerminalShellIntegration ,
2929 withProgress ,
3030} from './common/window.apis' ;
31- import { getConfiguration } from './common/workspace.apis' ;
31+ import { getConfiguration , getWorkspaceFolders } from './common/workspace.apis' ;
3232import { createManagerReady } from './features/common/managerReady' ;
3333import { AutoFindProjects } from './features/creators/autoFindProjects' ;
3434import { ExistingProjects } from './features/creators/existingProjects' ;
@@ -101,10 +101,25 @@ export async function activate(context: ExtensionContext): Promise<PythonEnviron
101101 // When disabled, the main Python extension handles environments instead (legacy mode).
102102 const config = getConfiguration ( 'python' ) ;
103103 const inspection = config . inspect < boolean > ( 'useEnvironmentsExtension' ) ;
104- const explicitlyDisabled =
105- inspection ?. globalValue === false ||
106- inspection ?. workspaceValue === false ||
107- inspection ?. workspaceFolderValue === false ;
104+
105+ // Check global and workspace-level explicit disables
106+ let explicitlyDisabled = inspection ?. globalValue === false || inspection ?. workspaceValue === false ;
107+
108+ // Also check folder-scoped settings in multi-root workspaces
109+ // (inspect() on an unscoped config won't populate workspaceFolderValue reliably)
110+ if ( ! explicitlyDisabled ) {
111+ const workspaceFolders = getWorkspaceFolders ( ) ;
112+ if ( workspaceFolders ) {
113+ for ( const folder of workspaceFolders ) {
114+ const folderConfig = getConfiguration ( 'python' , folder . uri ) ;
115+ const folderInspection = folderConfig . inspect < boolean > ( 'useEnvironmentsExtension' ) ;
116+ if ( folderInspection ?. workspaceFolderValue === false ) {
117+ explicitlyDisabled = true ;
118+ break ;
119+ }
120+ }
121+ }
122+ }
108123
109124 const useEnvironmentsExtension = ! explicitlyDisabled ;
110125 traceInfo ( `Experiment Status: useEnvironmentsExtension setting set to ${ useEnvironmentsExtension } ` ) ;
0 commit comments