PeterWone / vscode-arduino-cli

Integration of the Arduino CLI into VS Code
Other
9 stars 2 forks source link

C++ intellisense #2

Open PeterWone opened 4 years ago

PeterWone commented 4 years ago

This is a matter of supplying paths in a c_cpp_properties.json file in the root of the workspace.

Arduino code is basically C with implicitly imported libraries. Syntax colouring and Intellisense are provided by the C/C++ language service, and it needs some config for this, which we supply in c_cpp_properties.json

Like everyone else I'm a bit hazy on this but once you realise the question is more about the C language service and exactly what it needs we can start looking in the docs and issues for that extension.

One of the more confusing things about Arduino header files is why the same files seem to be duplicated endlessly in the folders accompanying the Arduino IDE. The answer (for those who have yet to fathom this) is there is a slightly different suite of libs and headers for each permutation of Arduino hardware.

If you've told our extension exactly what board then it knows the pertinent "core" (toolchain and libs and headers) and we can get paths for the core in question and set up c_cpp_properties.json appropriately.