Cannot open source file "Arduino.h" when I have native environment

My code is compiling and uploading fine, but im getting an #include error saying “cannot open source file Arduino.h”. My platformio.ini file is the following

The thing I noticed is if I add “framework=arduino” to the desktop environment or remove the desktop environment entirely, the error goes away.

I have tried

  • Deleting .vscode folder
  • Deleting .platformio folder
  • Rebuilding pio intelisense

Intellisense is provided for the first environment in the platformio.ini, not all at once. So that’s normal.

It behaves correctly when moving the second env one upwards?

That works! Thank you.

Do you know where in the documentation it says that? Could not seem to find it if it is there.

… or is the the last one built? I thought I used to see intellisense switching define block highlighting, etc when I was building for different environments?