Skip to content

Empty item in env field inside c_cpp_properties.json causes error #2532

@schperplata

Description

@schperplata

Type: LanguageService
Issue Type: Bug

I'm playing around with using VS Code for embedded project. I have created a c_cpp_properties.json file, where I am planing to list all directories and files inside of different "env" fields and than passing this values to "configuration" "includePath", "browse" and "define" fields.

The problem specifically is caused by an empty field, followed by a non empty field, see example below:

{
    "env": {
        ...
        "userDefines": [],
        ...
        "cubeMXDefines": [
            "USE_HAL_DRIVER",
            "STM32F078xx"
        ],
        ...
    },
    "configurations": [
        {
            ...
            "defines": [
                "${userDefines}",
                "${cubeMXDefines}"
            ],
            ...
        }
    ],
    "version": 4
}

As you can see, userDefines field is empty, while cubeMXDefines in not. While editing main.c for example, I get an error in problems tab:
defines error

If I write anything into userDefines field, Intellisense works as expected.
Is there something I am missing, or is this a bug (not handled empty env field)?

VS Code version: Code 1.27.2 (f46c4c469d6e6d8c46f268d1553c5dc4b475840f, 2018-09-12T16:17:45.060Z)
OS version: Windows_NT x64 10.0.17134

System Info
Item Value
CPUs Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz (4 x 2494)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 7.95GB (3.16GB free)
Process Argv C:\Users\domen\AppData\Local\Programs\Microsoft VS Code\Code.exe
Screen Reader no
VM 0%
Extensions (6)
Extension Author (truncated) Version
bracket-pair-colorizer Coe 1.0.60
CppSnippets har 0.0.13
cortex-debug mar 0.1.21
python ms- 2018.8.0
cpptools ms- 0.18.1
debug web 0.22.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.quick fix

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions