'Visual Studio Code IntelliSense for Arduino and DxCore

Has anyone here gotten IntelliSense to work relatively flawlessly in Visual Studio Code for Arduino with DxCore projects? I've gotten most of the way, but still have some issues.

For me, any calls to Serial.printf() get marked with a red squiggly. Ctrl+clicking on printf shows me the definition just fine. Other things here and there have the same behavior. For example, va_start within the printf definition.

In addition to that, when verifying the sketch, I get: [Error] Failed to read or write IntelliSense configuration: {} Don't think it's a real problem, but it's annoying.

Here's my c_pp_properties.json file:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "C:\\Users\\nabel\\OneDrive\\Documents\\ArduinoData\\packages\\DxCore\\hardware\\megaavr\\**",
                "C:\\Users\\nabel\\OneDrive\\Documents\\Arduino\\libraries\\**",
                "C:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\**",
                "C:\\Program Files (x86)\\Arduino\\hardware\\tools\\**",
                "C:\\Program Files (x86)\\Arduino\\tools\\**",
                "C:\\Program Files (x86)\\Arduino\\libraries\\**"
            ],
        "forcedInclude": [
            "C:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino\\Arduino.h"
        ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE",
                "ARDUINO=10816", // Should be updated for version of Arduino IDE installed; https://stackoverflow.com/a/30928558
                "USBCON"
            ],
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-msvc-x64"
        }
    ],
    "version": 4
}

If anyone has IntelliSense working well, could you share your c_pp_properties.json file? Thanks!



Solution 1:[1]

JSON doesn't allow javascript comments my friend! Remove it and Bob's your uncle.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Maziar Rezaei