PlatformIO compiles wrong projects


yes I see there is a similar topic, but …

I have Visual Studio Code (1.65.1) with PlatformIO (core 5.1.0, home 3.3.3 ?) on Win10 and I’m using ESP-IDF for ESP32. Until last week it worked more or less well.

  1. Yesterday I created a new project. But PlatformIO didn’t compile it. It compiled the first project from the explorer.
  2. So I closed VS Code and renamed the first project. After restarting VS Code it still showed the old name. Pushing the “refresh explorer”-button had no effect. Now PlatformIO compiled the second project from top.
  3. Again I closed VS Code and moved all projects to a different folder. Now I was able to compile the right project.
  4. But today the same problem: creating a new project, PlatformIO is compiling the project from yesterday. And there is no orange dot or something else on the right side of a folder name.

VS Code/PlatformIO stills shows all folder names in the explorer although I moved them to a different place. Where does it gets all these names from?

And what is wrong? Do I have to unistall and reinstall VS Code and PlatformIO?

Kind regards

A small self-reply:

I made a left-mouse click on the icon “switch PlatformIO project environment” at lower edge. Then I got a popup-meü with 4 entries for the 2 projects. With return for the first entry the desired projects seems to be active and I can compile/upload the code.

Still explorer inside VS Code/PlatformIO shows all removed projects.

I wish there would be a good documentation of IDE for beginners …

Kind regards

The project and environment selection mechanisms are documented at PlatformIO IDE for VSCode — PlatformIO latest documentation, alongside a whole else.

That shouldn’t happen. My project selector only shows the projects that are also added in my VSCode workspace (see explorer pane on the left).

Is that different for you?

On a sidenote, the behavior before 2.3.0 was that PlatformIO tried to detect the opened file and the project with it, and match the upload / build buttons behavior to that. Many, many people reported that this wasn’t properly working for them and so it was exchanged for this more explicit selection. See also Having to separately select a default to compile and upload since v2.3.0 · Issue #2410 · platformio/platformio-vscode-ide · GitHub.