@@ -30,7 +30,7 @@ import { removePythonProjectSetting, setEnvironmentManager, setPackageManager }
3030
3131import { executeCommand } from '../common/command.api' ;
3232import { clipboardWriteText } from '../common/env.apis' ;
33- import { } from '../common/errors/utils' ;
33+ import { } from '../common/errors/utils' ;
3434import { Pickers } from '../common/localize' ;
3535import { pickEnvironment } from '../common/pickers/environments' ;
3636import {
@@ -606,8 +606,9 @@ export async function createTerminalCommand(
606606 api : PythonEnvironmentApi ,
607607 tm : TerminalManager ,
608608) : Promise < Terminal | undefined > {
609- if ( context === undefined ) {
610- const pw = await pickProject ( api . getPythonProjects ( ) ) ;
609+ const pythonProjects = api . getPythonProjects ( ) ;
610+ if ( context === undefined || pythonProjects . length > 0 ) {
611+ const pw = await pickProject ( pythonProjects ) ;
611612 if ( pw ) {
612613 const env = await api . getEnvironment ( pw . uri ) ;
613614 const cwd = await findParentIfFile ( pw . uri . fsPath ) ;
@@ -641,7 +642,7 @@ export async function createTerminalCommand(
641642 }
642643 } else if ( context instanceof PythonEnvTreeItem ) {
643644 const view = context as PythonEnvTreeItem ;
644- const pw = await pickProject ( api . getPythonProjects ( ) ) ;
645+ const pw = await pickProject ( pythonProjects ) ;
645646 if ( pw ) {
646647 const cwd = await findParentIfFile ( pw . uri . fsPath ) ;
647648 const terminal = await tm . create ( view . environment , { cwd } ) ;
0 commit comments