Skip to content

Commit a81a097

Browse files
committed
Do not show "Default" environment when a project does not have any build environments // Resolve platformio#2450
1 parent 0a5ae4e commit a81a097

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## 2.3.1 (2021-??-??)
44

5-
- Automatically activate project environment opened via PIO Home > New Project / Open Project (issue [#2414](https://github.com/platformio/platformio-vscode-ide/issues/2414))
5+
- Automatically activate project environment opened via "PIO Home > New Project / Open Project" (issue [#2414](https://github.com/platformio/platformio-vscode-ide/issues/2414))
6+
- Do not show "Default" environment when a project does not have any build environments (issue [#2450](https://github.com/platformio/platformio-vscode-ide/issues/2450))
67

78
## 2.3.0 (2021-03-03)
89

src/project/observable.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,21 +230,25 @@ export default class ProjectObservable {
230230
async pickProjectEnv() {
231231
const items = [];
232232
for (const projectDir of ProjectObservable.getPIOProjectDirs()) {
233-
const shortPrpjectDir = `${path.basename(
233+
const observer = this._pool.getObserver(projectDir);
234+
const envs = await observer.getProjectEnvs();
235+
if (!envs || !envs.length) {
236+
continue;
237+
}
238+
const shortProjectDir = `${path.basename(
234239
path.dirname(projectDir)
235240
)}/${path.basename(projectDir)}`;
236241
items.push({
237242
projectDir,
238243
label: 'Default',
239-
description: `$(folder) ${shortPrpjectDir} ("default_envs" from "platformio.ini")`,
244+
description: `$(folder) ${shortProjectDir} ("default_envs" from "platformio.ini")`,
240245
});
241-
const observer = this._pool.getObserver(projectDir);
242246
items.push(
243-
...(await observer.getProjectEnvs()).map((item) => ({
247+
...envs.map((item) => ({
244248
projectDir,
245249
envName: item.name,
246250
label: `env:${item.name}`,
247-
description: `$(folder) ${shortPrpjectDir}`,
251+
description: `$(folder) ${shortProjectDir}`,
248252
}))
249253
);
250254
}

0 commit comments

Comments
 (0)