@@ -8,6 +8,7 @@ import { PythonEnvironmentApi, PythonProject } from '../../api';
8
8
import { findFiles } from '../../common/workspace.apis' ;
9
9
import { EXTENSION_ROOT_DIR } from '../../common/constants' ;
10
10
import { Installable , selectFromCommonPackagesToInstall , selectFromInstallableToInstall } from '../common/pickers' ;
11
+ import { traceInfo } from '../../common/logging' ;
11
12
12
13
async function tomlParse ( fsPath : string , log ?: LogOutputChannel ) : Promise < tomljs . JsonMap > {
13
14
try {
@@ -75,47 +76,56 @@ async function selectWorkspaceOrCommon(
75
76
installable : Installable [ ] ,
76
77
common : Installable [ ] ,
77
78
) : Promise < string [ ] | undefined > {
78
- if ( installable . length > 0 ) {
79
- const selected = await showQuickPickWithButtons (
80
- [
81
- {
82
- label : PackageManagement . workspaceDependencies ,
83
- description : PackageManagement . workspaceDependenciesDescription ,
84
- } ,
85
- {
86
- label : PackageManagement . commonPackages ,
87
- description : PackageManagement . commonPackagesDescription ,
88
- } ,
89
- ] ,
90
- {
91
- placeHolder : Pickers . Packages . selectOption ,
92
- ignoreFocusOut : true ,
93
- showBackButton : true ,
94
- matchOnDescription : false ,
95
- matchOnDetail : false ,
96
- } ,
97
- ) ;
98
- if ( selected && ! Array . isArray ( selected ) ) {
99
- try {
100
- if ( selected . label === PackageManagement . workspaceDependencies ) {
101
- return await selectFromInstallableToInstall ( installable ) ;
102
- } else if ( selected . label === PackageManagement . commonPackages ) {
103
- return await selectFromCommonPackagesToInstall ( common ) ;
104
- }
105
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
106
- } catch ( ex : any ) {
107
- if ( ex === QuickInputButtons . Back ) {
108
- return selectWorkspaceOrCommon ( installable , common ) ;
109
- }
110
- }
111
- }
79
+ if ( installable . length === 0 && common . length === 0 ) {
112
80
return undefined ;
113
81
}
114
82
83
+ const items = [ ] ;
84
+ if ( installable . length > 0 ) {
85
+ items . push ( {
86
+ label : PackageManagement . workspaceDependencies ,
87
+ description : PackageManagement . workspaceDependenciesDescription ,
88
+ } ) ;
89
+ }
90
+
115
91
if ( common . length > 0 ) {
116
- return selectFromCommonPackagesToInstall ( common ) ;
92
+ items . push ( {
93
+ label : PackageManagement . commonPackages ,
94
+ description : PackageManagement . commonPackagesDescription ,
95
+ } ) ;
117
96
}
118
97
98
+ if ( items . length > 0 ) {
99
+ items . push ( { label : PackageManagement . skipPackageInstallation } ) ;
100
+ } else {
101
+ return undefined ;
102
+ }
103
+
104
+ const selected = await showQuickPickWithButtons ( items , {
105
+ placeHolder : Pickers . Packages . selectOption ,
106
+ ignoreFocusOut : true ,
107
+ showBackButton : true ,
108
+ matchOnDescription : false ,
109
+ matchOnDetail : false ,
110
+ } ) ;
111
+
112
+ if ( selected && ! Array . isArray ( selected ) ) {
113
+ try {
114
+ if ( selected . label === PackageManagement . workspaceDependencies ) {
115
+ return await selectFromInstallableToInstall ( installable ) ;
116
+ } else if ( selected . label === PackageManagement . commonPackages ) {
117
+ return await selectFromCommonPackagesToInstall ( common ) ;
118
+ } else {
119
+ traceInfo ( 'Package Installer: user selected skip package installation' ) ;
120
+ return undefined ;
121
+ }
122
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
123
+ } catch ( ex : any ) {
124
+ if ( ex === QuickInputButtons . Back ) {
125
+ return selectWorkspaceOrCommon ( installable , common ) ;
126
+ }
127
+ }
128
+ }
119
129
return undefined ;
120
130
}
121
131
0 commit comments