File tree Expand file tree Collapse file tree
src/client/pythonEnvironments Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -245,9 +245,13 @@ class ComponentAdapter implements IComponentAdapter {
245245 this . refreshing . fire ( ) ;
246246
247247 const query : PythonLocatorQuery = { } ;
248+ let roots : vscode . Uri [ ] = [ ] ;
248249 let wsFolder : vscode . WorkspaceFolder | undefined ;
249250 if ( resource !== undefined ) {
250251 wsFolder = vscode . workspace . getWorkspaceFolder ( resource ) ;
252+ if ( wsFolder ) {
253+ roots = [ wsFolder . uri ] ;
254+ }
251255 }
252256 // Untitled files should still use the workspace as the query location
253257 if (
@@ -256,18 +260,12 @@ class ComponentAdapter implements IComponentAdapter {
256260 vscode . workspace . workspaceFolders . length > 0 &&
257261 ( ! resource || resource . scheme === 'untitled' )
258262 ) {
259- [ wsFolder ] = vscode . workspace . workspaceFolders ;
263+ roots = vscode . workspace . workspaceFolders . map ( ( w ) => w . uri ) ;
260264 }
261265
262- if ( wsFolder !== undefined ) {
263- query . searchLocations = {
264- roots : [ wsFolder . uri ] ,
265- } ;
266- } else {
267- query . searchLocations = {
268- roots : [ ] ,
269- } ;
270- }
266+ query . searchLocations = {
267+ roots,
268+ } ;
271269
272270 let envs = this . api . getEnvs ( query ) ;
273271 if ( source ) {
You can’t perform that action at this time.
0 commit comments