@@ -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 { PackageInstallOptions , PythonEnvironmentApi , PythonProject } from '../../api' ;
7+ import { PackageInstallOptions , PythonEnvironment , PythonEnvironmentApi , PythonProject } from '../../api' ;
88import { findFiles } from '../../common/workspace.apis' ;
99import { EXTENSION_ROOT_DIR } from '../../common/constants' ;
1010import { Installable , selectFromCommonPackagesToInstall , selectFromInstallableToInstall } from '../common/pickers' ;
@@ -76,6 +76,7 @@ async function selectWorkspaceOrCommon(
7676 installable : Installable [ ] ,
7777 common : Installable [ ] ,
7878 showSkipOption : boolean ,
79+ installed ?: string [ ] ,
7980) : Promise < string [ ] | undefined > {
8081 if ( installable . length === 0 && common . length === 0 ) {
8182 return undefined ;
@@ -116,7 +117,7 @@ async function selectWorkspaceOrCommon(
116117 if ( selected . label === PackageManagement . workspaceDependencies ) {
117118 return await selectFromInstallableToInstall ( installable ) ;
118119 } else if ( selected . label === PackageManagement . commonPackages ) {
119- return await selectFromCommonPackagesToInstall ( common ) ;
120+ return await selectFromCommonPackagesToInstall ( common , installed ) ;
120121 } else {
121122 traceInfo ( 'Package Installer: user selected skip package installation' ) ;
122123 return undefined ;
@@ -135,10 +136,15 @@ export async function getWorkspacePackagesToInstall(
135136 api : PythonEnvironmentApi ,
136137 options ?: PackageInstallOptions ,
137138 project ?: PythonProject [ ] ,
139+ environment ?: PythonEnvironment ,
138140) : Promise < string [ ] | undefined > {
139141 const installable = ( await getProjectInstallable ( api , project ) ) ?? [ ] ;
140142 const common = await getCommonPackages ( ) ;
141- return selectWorkspaceOrCommon ( installable , common , ! ! options ?. showSkipOption ) ;
143+ let installed : string [ ] | undefined ;
144+ if ( environment ) {
145+ installed = ( await api . getPackages ( environment ) ) ?. map ( ( pkg ) => pkg . name ) ;
146+ }
147+ return selectWorkspaceOrCommon ( installable , common , ! ! options ?. showSkipOption , installed ) ;
142148}
143149
144150export async function getProjectInstallable (
0 commit comments