Switching between envs via GUI

Currently I have several different envs defined in my platformio.ini: one for debug builds, one for release builds, one for OTA flashing etc.

Is there an easy way to switch between these envs? Preferably via the GUI?

Currently I always need to change the default_envs setting in my platformio.ini. That is not very comfortable. I would like to have some kind of drop down selection box, where I can choose the current env I want to use.

Do you use PlatformIO IDE for VSCode? It has task explorer where you can run specific env based task.

1 Like

As Ivan mentioned, if you’re using VSCode as your IDE, you can use the Project Tasks section to work with the different environments… ie. in this screenshot I can do either 2 or 3 at will…


1 Like

I have the same issue and while searching for a solution I found this thread. With all the respect I have for the work done by the PIO maintainers (And I really love what you are doing here) I have to disagree with the current solution as it does not solve all issues and it’s usability is really not that good. Let me explain my point of view …

Currently my platformio.ini looks like this:

default_envs = nucleo_f446re

platform = ststm32
framework = stm32cube

board = nucleo_f103rb

board = nucleo_f446re

This has allows me to simply press the download and/or compile button in the status bar of VSCode AND it causes the C/Cpp index of VSCode to be tailored to the platform in use. So basically it works very well this way. The drawback is that I have to take care to not commit the default_envs setting as this reflects something like a personal flavor or setting which applies just today. I don’t know if can describe my point of view in such a way that you get it right. Anyway … there shall be a default env as this is perfectly valid for tasks like a automated build, but imho the env to apply in the IDE is a setting which belongs to the IDE only, shall be switchable easily in the gui and shall not affect the ini file which I want to commit.

The approach of using the Pio tasks as stated before does also not apply the index … if no default is provided all env’s are in the index and this causes F12 to present always a file list to choose from which is annoying after some hours of intensive work. Also frequently switching between the Explorer View and the PIO view is not user friendly.

What about about adding a small field in the status bar as the “Code Spell Checker” plugin does … you can click on it, a tab opens up and you can change setting. One could easily select the env to use there.

Finally … All of this is complaining on a very high level, but I thing you want to provide a very good user experience. But then such things should be discussed :wink:

1 Like

I understand what do you mean. This feature

This feature is already implemented in PlatformIO for CLion IDE. We will implement this in VSCode.


:+1: One more reason to give CLion a try! Is there a schedule for VSCode available? And in the long run … Will one of them be the main or preferred IDE? I think now it’s VCode but as you have started with CLion I assume you might want to focus on it once the support is mature enough?

br J.

We plan to support both. If we have tomorrow something better than VSCode or CLion, we provide support too.

1 Like