microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.52k stars 1.55k forks source link

Incorrect configuration JSON/UI warnings appear when quotes are used #11955

Open sean-mcmanus opened 8 months ago

sean-mcmanus commented 8 months ago

Use "" in an includePath and open the c_cpp_properties.json or the config UI.

e.g.

            "includePath": [
                "${workspaceFolder}/**",
                "\"${workspaceFolder}\\new folder\""
            ],
image

Bug: It's giving an incorrect warning message. It seems like the "correct" include path ends up getting used though, but it seems possible there could be a case in which it could be wrong.

Not found by me, but by "other internal testing".

Colengms commented 8 months ago

Is this a bug? This seems by-design. We shouldn't do any "shell escaping" for include paths. Not only aren't they on a command line, but they aren't being interpreted in the context of command line arguments. The paths in your example should not work with quotes in them unless there are also quotes in them in the file system.

It is legitimate to have a direct name that starts with or ends with a quote on Linux or Mac. We shouldn't incur special handling where it's not specifically required and expected.