@@ -4,7 +4,7 @@ import * as tomljs from '@iarna/toml';
44import { LogOutputChannel , ProgressLocation , QuickInputButtons , Uri } from 'vscode' ;
55import { showQuickPickWithButtons , withProgress } from '../../common/window.apis' ;
66import { PackageManagement , Pickers , VenvManagerStrings } from '../../common/localize' ;
7- import { PythonEnvironmentApi , PythonProject } from '../../api' ;
7+ import { PackageInstallOptions , PythonEnvironmentApi , PythonProject } from '../../api' ;
88import { findFiles } from '../../common/workspace.apis' ;
99import { EXTENSION_ROOT_DIR } from '../../common/constants' ;
1010import { Installable , selectFromCommonPackagesToInstall , selectFromInstallableToInstall } from '../common/pickers' ;
@@ -75,6 +75,7 @@ async function getCommonPackages(): Promise<Installable[]> {
7575async function selectWorkspaceOrCommon (
7676 installable : Installable [ ] ,
7777 common : Installable [ ] ,
78+ showSkipOption : boolean ,
7879) : Promise < string [ ] | undefined > {
7980 if ( installable . length === 0 && common . length === 0 ) {
8081 return undefined ;
@@ -95,19 +96,20 @@ async function selectWorkspaceOrCommon(
9596 } ) ;
9697 }
9798
98- if ( items . length > 0 ) {
99+ if ( showSkipOption && items . length > 0 ) {
99100 items . push ( { label : PackageManagement . skipPackageInstallation } ) ;
100- } else {
101- return undefined ;
102101 }
103102
104- const selected = await showQuickPickWithButtons ( items , {
105- placeHolder : Pickers . Packages . selectOption ,
106- ignoreFocusOut : true ,
107- showBackButton : true ,
108- matchOnDescription : false ,
109- matchOnDetail : false ,
110- } ) ;
103+ const selected =
104+ items . length === 1
105+ ? items [ 0 ]
106+ : await showQuickPickWithButtons ( items , {
107+ placeHolder : Pickers . Packages . selectOption ,
108+ ignoreFocusOut : true ,
109+ showBackButton : true ,
110+ matchOnDescription : false ,
111+ matchOnDetail : false ,
112+ } ) ;
111113
112114 if ( selected && ! Array . isArray ( selected ) ) {
113115 try {
@@ -122,7 +124,7 @@ async function selectWorkspaceOrCommon(
122124 // eslint-disable-next-line @typescript-eslint/no-explicit-any
123125 } catch ( ex : any ) {
124126 if ( ex === QuickInputButtons . Back ) {
125- return selectWorkspaceOrCommon ( installable , common ) ;
127+ return selectWorkspaceOrCommon ( installable , common , showSkipOption ) ;
126128 }
127129 }
128130 }
@@ -131,11 +133,12 @@ async function selectWorkspaceOrCommon(
131133
132134export async function getWorkspacePackagesToInstall (
133135 api : PythonEnvironmentApi ,
136+ options ?: PackageInstallOptions ,
134137 project ?: PythonProject [ ] ,
135138) : Promise < string [ ] | undefined > {
136139 const installable = ( await getProjectInstallable ( api , project ) ) ?? [ ] ;
137140 const common = await getCommonPackages ( ) ;
138- return selectWorkspaceOrCommon ( installable , common ) ;
141+ return selectWorkspaceOrCommon ( installable , common , ! ! options ?. showSkipOption ) ;
139142}
140143
141144export async function getProjectInstallable (
0 commit comments