Vscode + Pio extension: default build is always env_defaults


I don’t know if I’m doing something wrong or not. I have a platformio.ini with many envs and one selected as env_default. I would like to build a different env in vscode without change .ini. Is it possible?
I though that using “configure default build task” was for this action. I selected a different env (and I see it when trying to change again build task) but when I press icon for build (status bar), it always build env_default…


The configure default build task option appears to be purely VSCode related (hence why it’s editing tasks.json), which is why it wouldn’t change the default. The only way it could currently happen would be through a change to the platformio.ini, so wouldn’t do what you wanted anyway,

I only know of two options - either through the GUI, and build your specific environment , or specifying it by name at the terminal. Otherwise, if you want to change the default, you’ll have to change env_default


Thanks for your answer, this is what I usually do but I hoped to a solution that didn’t involve platformio.ini.
Project I’m working on is Marlin firmware but for a different ‘env’ than default. Changing .ini means I have to restore it every time I post a PR and I’m lazy.

Edit: it would be nice that with task.json a --environment will be added to default options, this way this issue could solved

1 Like