Intellisense and Library Defines

In my library.json file, I have -DESP_IDF. Shouldn’t IntelliSense pick this up?

image

What’s the exact file content?

{
      "name": "esp-homekit",
      "keywords": "homekit",
      "description": "HomeKit",
      "license": "MIT",
      "version": "0.01",
      "frameworks": "espidf",
      "platforms": [
            "espressif32"
      ],
      "dependencies": {
            "esp-wolfssl" : "4.1.0"
      },
      "build": {
            "flags": [
                  "-w",
                  "-DWOLFSSL_USER_SETTINGS",
                  "-DWOLFCRYPT_HAVE_SRP",
                  "-DWOLFSSL_SHA512",
                  "-DWOLFSSL_BASE64_ENCODE",
                  "-DNO_MD5",
                  "-DNO_SHA",
                  "-DHAVE_HKDF",
                  "-DHAVE_CHACHA",
                  "-DHAVE_POLY1305",
                  "-DHAVE_ED25519",
                  "-DHAVE_CURVE25519",
                  "-DNO_SESSION_CACHE",
                  "-DUSE_WOLFSSL_MEMORY",
                  "-DRSA_LOW_MEM",
                  "-DGCM_SMALL",
                  "-DUSE_SLOW_SHA512",
                  "-DWOLFCRYPT_ONLY",
                  "-DCURVE25519_SMALL",
                  "-DED25519_SMALL",
                  "-DESP_IDF",
                  "-DHOMEKIT_MAX_CLIENTS=15",
                  "-DSPIFLASH_BASE_ADDR=0xA000",
                  "-DHOMEKIT_OVERCLOCK=1",
                  "-DHOMEKIT_OVERCLOCK_PAIR_SETUP=1",
                  "-DHOMEKIT_OVERCLOCK_PAIR_VERIFY=1",
                  "-DHOMEKIT_DEBUG=1"
            ],
            "srcFilter": [
                  "+<json.c>",
                  "+<pairing.c>",
                  "+<storage.c>",
                  "+<tlv.c>",
                  "+<server.c>",
                  "+<debug.c>",
                  "+<accessories.c>",
                  "+<base64.c>",
                  "+<port.c>",
                  "+<query_params.c>",
                  "+<crypto.c>",
                  "-<mdnsresponder.c>"
            ]
      }
}

image

Hmmm c_cpp_properties only has this

“defines”: [
“WITH_POSIX”,
“UNITY_INCLUDE_CONFIG_H”,
"IDF_VER=“3.30300.190916"”,
“PLATFORMIO=40202”,
“ARDUINO_ESP32_DEV”,
“ESP32”,
“ESP_PLATFORM”,
“F_CPU=240000000L”,
“HAVE_CONFIG_H”,
“MBEDTLS_CONFIG_FILE=“mbedtls/esp_config.h””,
“GCC_NOT_5_2_0=0”,
“PROJECT_NAME=“esp-idf””,
"PROJECT_VER=“1.0.0"”,
“”

So it’s not picking up the defines in the library.json file…

These are special build settings for a single library. PlatformIO can handle it and your code should build successfully.

But Visual Studio Code’s IntelliSense uses the project build settings for all the code.