Good morning.
I use PlatformIO Core 4.3.3 / Home 3.2.1 with VSCodium 1.44.1 on a Windows10 PC.
Each time when I open a new project (Quick Access on the Home Screen) and try to build the project the project which was loaded before is builded.
First I have to open the platformio.ini file of the desired project to force the correct build.
Is this correct ?
Thanks and regards
Rainer
Hi @rainer1 and welcome to the community! Youāll find a lot of help here.
Iām no guru but I had a similar problem, and Iām still not completely across it, but I think what happens is this.
Platformio/VS Code can have multiple projects open at the same time. If you see a workspace name or āUntitled (workspace)ā in the explorer bar chances are you have two (or more) projects open. If so you can right click on the project(s) you do not want and select āremove folder from workspaceā, so that only the project you are working on is loaded into PlatformIO. When you build then, this should be the project that gets compiled and uploaded.
VS code also lets you keep files from a project open even if the project is not in the explorer bar any more. So if you remover a folder from the workspace one or more files from the project could still be open for editng. I make it a rule to close all the files for a project files before I remove the project folder, then there is hopefully less chance of editing the wrong file and wondering why your changes arenāt doing anything (been there, done thatā¦).
Finally, itās my understanding, but I could be wrong, that PlatformIO will build everything that is loaded in the explorer bar. Not necessarily the files you have open for editing. So if you have multiple projects loaded it will build them all. This may not be what you want to happen. Itās probably good for larger projects with a lot of functionality, that can be broken down into sub-projects managed in different folders, but for small projects, Iāve found anyway, keeping all the files in one folder (i.e. project) works fine, and I have everything in one project.
Hope this helps.
BTW this is a first for me too. Iāve asked a lot of questions in this forum and received a LOT of help, but this is the first time Iāve had a shot at answering a question. So I hope my answer helps. If Iām wrong the gurus will sort it out!
@mogplus8 Your contribution is always welcome!
My only point of clarification would be:
I donāt think this is the case⦠you might be confusing this with a single project that has multiple boards⦠only one project will be built at a time, but if there are multiple boards, if you do the ⦠global? ⦠build option, all boards of that project will be built. If youāre only interested in the one board, better to either pick build against that specific board (āenvironmentā) or specify it as the default board for that project (`default_envsā).
In a nutshell, whatever project the file/tab you have in focus belongs to will be the one that is built.
Thanks guys for the feedback. What you describe is identically to what I observe.
(Only one project was ever build)
Iām missing a menu item āselect activ projectā or "close project " (see Eclipse or other IDEās)
The current behaviour is a bit strange from my point of view.
I will check the VSCode / VSCodium pages if I found any helpfull information concerning his āissueā.
Equivalent of that would be the default_envs
platformio.ini parameter. You wonāt find any PlatformIO configuration stuff in the menus - as all that is VSCode related. Youāll only find stuff in PIO Home.
Edit: A feature slated to be added to the PlatformIO VSCode extension 2.0 which is currently in development is the ability to select the project without needing to edit the platformio.ini
, so keep an eye out for that!
Now I removed an opened project always from workspace before using a different one and it worked as expected. This flow is ok for me.
Thanks and regards
Rainer
Iām confused by this. I donāt see where the environment sets the project directory. I get this error semi-regularly, and itās quite annoying.
Are you selecting the right project and environment per the new selector? IDE compiles wrong Project File - #4 by maxgerhardt
Oh, wow. There it is right there in the toolbar. Donāt know how new that is or how I missed it, but thatās exactly what Iām looking for.
Thanks.
Itās new since extension version 2.3.0 ā also see IDE compiles wrong Project File - #6 by maxgerhardt