microsoft / vscode-arduino

Visual Studio Code extension for Arduino
Other
1.15k stars 206 forks source link

Intellisense always fails with ArduinoJson library #1688

Open raffaeler opened 10 months ago

raffaeler commented 10 months ago

The ArduinoJson library is extremely popular, therefore I believe it is important to validate it is correctly managed by the Intellisense. A sample snippet:

#include <ArduinoJson.h>
// ...
DynamicJsonDocument doc(1024);
doc["address"] = address;
doc["previous"] = address;
doc["message"] = "ok";

The DynamicJsonDocument is squiggled as unrecognized: image

The relevant lines in the includePath section of c_cpp_properties.json file are:

"C:\\username\\raffaeler\\Documents\\Arduino\\libraries\\ArduinoJson\\src",
"C:\\username\\raffaeler\\Documents\\Arduino\\libraries\\ArduinoJson\\src/**",

A possible reason is that the files in the ArduinoJson library have the .hpp extension.

raffaeler commented 10 months ago

BTW, is there any way to disable the squiggles only for specific lines (maybe with some preprocessor command)? Alternatively, providing a list of types/words not to be checked/squiggled. TIA

raffaeler commented 10 months ago

One more info. I go to the definition of #include <ArduinoJson.h>. I can also navigate to the inner includes. But when I reach the JsonSerializer.cpp I see this: image

raffaeler commented 8 months ago

Ironically, I moved my dev installation and projects on Ubuntu and it all works like a charm. I hope this helps in the issue identification.