Vscode-cpptools: String arrays in `env` are not joined properly

Created on 16 May 2020  路  4Comments  路  Source: microsoft/vscode-cpptools

Type: LanguageService

Describe the bug

  • OS and Version: macOS 10.15.4
  • VS Code Version: 1.45.1
  • C/C++ Extension Version: 0.28.0

In #5229 environment variables were changed to be split using a platform-specific delimiter (; on Windows and : for everything else, like Linux and macOS). However, joining arrays of strings in the env variable in c_cpp_properties.json was not properly updated to match this new behavior, causing such variables to be incorrectly parsed when substituted in configurations.

This causes bugs like lists of include directories to not resolve properly when used in multiple configurations on non-Windows machines.

Steps to reproduce

  1. Add a variable containing an array of strings to the env section of c_cpp_properties.json.
  2. Reference this variable in a configuration.
{
    "env": {
        "commonIncludes": [
            "${workspaceFolder}/path/to/dir1",
            "${workspaceFolder}/path/to/dir2"
        ]
    },
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${commonIncludes}"
            ]
        }
    ],
    "version": 4
}

Incorrect behavior

-------- Diagnostics - 5/15/2020, 10:07:43 PM
Version: 0.28.0
Current Configuration:
{
    "name": "Mac",
    "includePath": [
        "${workspaceFolder}/path/to/dir1;${workspaceFolder}/path/to/dir2"
    ],
    "compilerArgs": [],
    "browse": {
        "path": [
            "${workspaceFolder}/path/to/dir1;${workspaceFolder}/path/to/dir2",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
No active translation units.

Expected behavior

-------- Diagnostics - 5/15/2020, 10:09:10 PM
Version: 0.27.1
Current Configuration:
{
    "name": "Mac",
    "includePath": [
        "${workspaceFolder}/path/to/dir1",
        "${workspaceFolder}/path/to/dir2"
    ],
    "compilerArgs": [],
    "browse": {
        "path": [
            "${workspaceFolder}/path/to/dir1",
            "${workspaceFolder}/path/to/dir2",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
No active translation units.
Configuration Language Service bug fixed (release pending) regression

All 4 comments

Any way this can make it back into a 0.28.next? What's the ETA on 0.29.0?

@bryceschober Yes, this should get into our next release. I'd prefer to release an update next week, but we're not sure yet.

@sean-mcmanus Thanks for the back-port & bug-fix release.

Was this page helpful?
0 / 5 - 0 ratings