platformio-core
platformio-core copied to clipboard
Windows: Set "intelliSenseMode" property in c_cpp_properties.json file to "gcc-arm"
PlatformIO should set "intelliSenseMode" property in c_cpp_properties.json file to "gcc-arm".
Since PlatformIO uses gcc-arm, the Intellisense should use gcc-arm as well. During startup the IntelliSense mode is changed and following message is displayed:
[11/23/2020, 8:41:51 AM] For C++ source files, IntelliSenseMode was changed from “gcc-x64” to “gcc-arm” based on compiler args and probing compilerPath: “C:/Users/itsme/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc.exe”
Changing the c_cpp_properties.json manually to "gcc-arm" also work temporary as it is auto generated and platformio overwrites and set it back to "gcc-x64".
Should be fixed in the latest development version. Please open PlatformIO Core CLI in VSCode and type pio upgrade --dev. Does it work now?
Upgraded with the development version and it works now. Thanks. CLOSED
@ivankravets / @JeroenIoT
It seems some regression happened. intelliSenseMode is not in the c_cpp_properties.json, causing problems, like pointers being hinted as 8 bytes long when in fact they are 4.
This compiles without any issue (ESP8266), while VS Code IntelliSense tells static assertion failed...
static_assert(sizeof(void*) == 4);
static_assert(sizeof(int*) == 4);
static_assert(sizeof(const char*) == 4);
I can manually modify the c_cpp_properties.json and it helps until compiling/changing platform.ini, but it updates back itself then, discarding my change.
I also tried pio upgrade --dev of course, but sadly it doesn't help. I even tried regenerating the c_cpp_properties.json (delete it and then Project Tasks > Default > Misc > Rebuild IntelliSense Index).
Can we have issue reopen/re-fixed?
@ivankravets Thank you for reopen. I might fix it myself by pull request, just have few questions and thoughts on the matter.
IMO there should be a way to provide their own base c_cpp_properties.json file, but I see that would be a lot of work and edge cases to take care of... However, I guess allowing each platform (like espressif8266) to choose the closest match for intelliSenseMode (in my case: gcc-arm or any x86?) would be fine.
I can see platforms have platform.json and platform.py. Would be that fine to add the info there? I don't understand whole PlatformIO architecture design yet (libraries (+sdk?) <-> projects <-> platfroms (+sdk?) <-> board <-> tool chain). I imagine some tool chains work with both 32 and 64 bit, so I would be against deducing the mode from a tool chain the platform uses alone.
My best guess (which might be lacking) would be to assume platform has one mode set. And if there were boards/processor with multiple (is there any like this?), it would be listed as other platform, or if the time come the problem would be addressed again.
Also, I don't quite understand which what differs between arm and x86 of intelliSenseMode options for C/C++ in VS Code. (Actually asked at https://github.com/microsoft/vscode-cpptools/discussions/9764). Of course I know more or less that ARM (incl. RISC, like xtensa used by ESP8266) and x86 are different architectures, so some other defines are used, I could imagine some architecture specific code would be enabled in libs.
Other consideration is that having IDE specific (like VS Code specific) property attached to list of rather IDE-independent properties would be inappropriate. While I don't have any solid ideas around how to deal with that small issue, I would love to hear someone else opinion.
Indeed, we should contact the Microsoft team. We pass them the full path to the compiler and they fetch extra data in runtime.
Duplicate of https://github.com/microsoft/vscode-cpptools/issues/9765
So, while we wait for Microsoft fix the issue in their closed-source cpptools.exe language server, current workaround would be to add paste
,
"intelliSenseMode": "gcc-arm"
at one of last lines of generated c_cpp_properties.json file. Every single time you touch platformio.ini, or compile/upload your project... 😕
Now that it's logged on the Microsoft side they declared it a feature request instead of a bug and referr to 3-year old other feature request issues. Guess this one may take a few years to resolve.
Can someone prove it's a regerssion with a specific version?
Do we experience this issue with ESP32 as well, or just with ESP8266?
board = esp32dev works, the C/C++ logs show it fallbacks to intelliSenseMode: windows-gcc-x86 mode so the pointer sizes happen to be the same.
On the other hand, board = uno is broken, snce it falls back to intelliSenseMode: windows-gcc-x64, so it thinks a 8-bit AVR CPU has 64-bit pointers, although its 16-bit..
@maxgerhardt, does it mean that we should force VSCode to the "intelliSenseMode": "gcc-arm" for ESP products?
Any update on that?
At this point I am considering writing script to watch file modified date and set the intelliSenseMode to gcc-arm...