Skip to content

Commit 2c9a0d7

Browse files
Copiloteleanorjboyd
andcommitted
Add notification when re-selecting the same workspace environment
Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
1 parent dfc55b2 commit 2c9a0d7

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/features/envCommands.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {} from '../common/errors/utils';
2121
import { pickEnvironment } from '../common/pickers/environments';
2222
import { pickCreator, pickEnvironmentManager, pickPackageManager } from '../common/pickers/managers';
2323
import { pickProject, pickProjectMany } from '../common/pickers/projects';
24-
import { activeTextEditor, showErrorMessage } from '../common/window.apis';
24+
import { activeTextEditor, showErrorMessage, showInformationMessage } from '../common/window.apis';
2525
import { quoteArgs } from './execution/execUtils';
2626
import { runAsTask } from './execution/runAsTask';
2727
import { runInTerminal } from './terminal/runInTerminal';
@@ -271,6 +271,16 @@ export async function setEnvironmentCommand(
271271
});
272272

273273
if (selected) {
274+
// Check if the selected environment is already the current one
275+
// Only show notification when we have exactly one project and it already has this environment
276+
if (uris.length === 1) {
277+
const currentEnv = await em.getEnvironment(uris[0]);
278+
if (currentEnv?.envId.id === selected.envId.id) {
279+
// The environment is already selected for this project
280+
showInformationMessage('This environment is already selected for the workspace.');
281+
return;
282+
}
283+
}
274284
await em.setEnvironments(uris, selected);
275285
}
276286
} else {

0 commit comments

Comments
 (0)