Moved from https://github.com/Microsoft/vscode/issues/9733:
Steps to Reproduce: Open launch.json and hover over "environment":

I followed the example, but I'm getting Incorrect type. Expected "array". This page https://code.visualstudio.com/docs/editor/debugging says I should use "env", but I guess that's because it's for Node.js debugging and I'm trying to debug a C++ application?
@kieferrm the environment variables are name/value pairs within an array. Proper usage should be:
"environment": [{"name": "squid", "value": "clam"}, {"name": "squid1", "value": "clam1"}]
It is expecting an array which is defined by [ ] and then each name/value pair is within { }.
Ah I see thanks :)
What do you think about renaming this to env and make it behave just as with node.js debugging? This would make it more intuitive IMHO.
@jhasse we can take it into consideration. I feel like "environment" is very clear and since it is already there, it doesn't need to be typed :)
I have also updated the help example to include the array brackets.
Yes, so rather than have a consistent way to do the same thing across different languages (since environment isn't part of the language but...well...part of the environment) let's make it different for each language. And the confusion caused caused by the differences is totally worth not having to type out "environment" because it's already there.
@m-mcgowan @jhasse We will consider it for a future release.
Hi,
How can I access the env or args variables in C++ in my program?
For example, I want to access args[1] in my code or "name": "sceneFile", how can I make it happen?

Thanks,
Chunting
Just as you would with normal environment variables (getenv) or program arguments (argv).
As long as we're considering changes here, why do we need to express a list of environment variables as an array of associative arrays with a single entry in each? Could we just have an associative array where the key is the environment variable name and the value is the variable value itself? Something like:
"environment": { "_NO_DEBUG_HEAP": "1", "SEARCH_PATH": "c:/data" }
would be a lot easier to deal with. Or even just a plain array of "name=value" strings?
(FWIW, the current syntax is strange enough that I find myself Googling for it every time I need to add an environment variable.)
I'd like to throw in a +1 on this one, as having this consistent across various extensions would be highly beneficial. Especially googling for setting environment variables in launch.json gives you the docs of the C++ extension, which will not work for all other language stacks (and the docs are also not too obviously just applicable for the C++ extension if you just skim them).
Most helpful comment
@m-mcgowan @jhasse We will consider it for a future release.