C_cpp_properties.json is reseted when quitting and starting again VSCode

Hi there –

I’ve tried altering c_cpp_properties.json to provide my own path for avr-gcc/include etc.

It works great till until I clode VSCode and reopen it. Then c_cpp_properties.json gets wiped clean and my includePath are gone…

Disabling Platformio Extension fixes the issue but I’m losing all the other benefits…

– Ladislas

That is normal behavior. Use Redirecting... to manage C/C++ flags

Well no I’m talking about that. I know how to set my own flags and I’m already using it with great success when compiling – everything works fine here.

I’m talking about Intellisense with VSCode and the includePath it uses to provide autocompletion and magic while coding.

It is located here: $ProjectName/.vscode/c_cpp_properties.json – everytime I open VSCode, the modification I have made are removed.

Which modifications did you do for this file?

I reopen this thread, because after googling there is no answer to this problem.
I use platformio (core 6.1.6, home 3.4.3) with platfom ST STM32 15.4.1.
At each vscode openning, the $ProjectName/.vscode/c_cpp_properties.json is reseted by whom? i do not know!
The c_cpp_properties.json contains a STM32 platform path with escape char. (Escaped bracket \( and \) for my case)

The IntelliSense say that this line is faulty due to the presence of the escape chars, and so in my code all #include <Arduino.h> are not found by intelliSense.
So at each opening, i unescape manually the c_cpp_properties.json. All comes back to normal then.
But if i close and re-open again vscode, this file is overwrite. And so i have to unescape the file again.
How to correct this behavior ? Is this the correct forum ?

That has been fixed 3 months ago, see Bug with IntelliSense and paths · Issue #655 · platformio/platform-ststm32 · GitHub, you need to update your platform through e.g. the CLI.

Thank a lot. It is working now.

The solution was to force an update of the ST STM32 even if updated version has the same number.
To update, i have done:
Open platformio home (The little house at the bottom of VsCode)
Go to Platforms on the left vertical menu
Select the “ST STM32” platform.
Select “Updates” (Top bar)
Select “Update”