Skip to content

Commit b63aeed

Browse files
committed
Version guards
1 parent 1d6f830 commit b63aeed

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/features/envCommands.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ export async function removeEnvironmentCommand(context: unknown, managers: Envir
308308
export async function handlePackageUninstall(context: unknown, em: EnvironmentManagers) {
309309
if (context instanceof PackageTreeItem || context instanceof ProjectPackage) {
310310
const moduleName = context.pkg.name;
311-
const environment = context instanceof ProjectPackage ? context.parent.environment : context.parent.environment;
311+
const environment = context.parent.environment;
312312
const packageManager = em.getPackageManager(environment);
313313
await packageManager?.manage(environment, { uninstall: [moduleName], install: [] });
314314
return;
@@ -319,7 +319,7 @@ export async function handlePackageUninstall(context: unknown, em: EnvironmentMa
319319
export async function handlePackageVersionManagement(context: unknown, em: EnvironmentManagers) {
320320
if (context instanceof PackageTreeItem || context instanceof ProjectPackage) {
321321
const pkg = context.pkg;
322-
const environment = context instanceof ProjectPackage ? context.parent.environment : context.parent.environment;
322+
const environment = context.parent.environment;
323323
const packageManager = em.getPackageManager(environment);
324324

325325
const version = await showInputBox({
@@ -338,7 +338,7 @@ export async function handlePackageVersionManagement(context: unknown, em: Envir
338338
},
339339
});
340340

341-
if (version === undefined) {
341+
if (version === undefined || version === pkg.version) {
342342
return;
343343
}
344344

0 commit comments

Comments
 (0)