Platformio/VSCode slow intellisense performance with Arduino SAMD platform

I’m using Platformio in VSCode for programming Adafruit Feather M0 (Arduino SAMD platform).

Each time I type in a source file, it takes roughly 20 seconds for the indexer to complete. During this time one CPU core is fully loaded. This is unpleasant and it wastes battery life if I use the notebook unplugged.

I have traced down the problem to mainly due to the include path
…/.platformio/packages/framework-arduinosam/system/samd/CMSIS-Atmel/CMSIS/Device/ATMEL
within the auto-generated c_cpp_properties.json file. This directory contains a bunch of sub-directories for each SAM & SAMD variant. For my board only SAMD21 is relevant. Thus if I append the path to
…/.platformio/packages/framework-arduinosam/system/samd/CMSIS-Atmel/CMSIS/Device/ATMEL/samd21
the indexing time reduces to 2-3 seconds, without loss of functionality.
Unfortunately my change is overwritten each time I restart VSCode.

Please check if you can generate the include path including the architecture sub-directory. Would be great.

Ok, I have a (semi-permanent) solution: I just delete all unused subdirectories. This should be fine until the next platform update… With this frequency of intervention I can live.