1

This question is related to this question about conda, and it is pretty straightforward:

How can I use an external environment variable inside launch.json?

For instance, selecting the python executable inside my home with $HOME, or the executable:

    {
        "name": "Python: From Home",
        "type": "python",
        "request": "launch",
        "program": "$HOME/Documents/a.py", // nor does "${HOME}" work
        "console": "internalConsole",
        "cwd": "${workspaceFolder}"
    }

or

    {
        "name": "Python: With Anaconda",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "internalConsole",
        "python": "${HOME}/anaconda3/bin/python3",
        "cwd": "${workspaceFolder}"
    }

This would simplify sharing launch.json with coworkers.

senseiwa
  • 2,119
  • 1
  • 22
  • 37
  • 1
    https://code.visualstudio.com/docs/editor/variables-reference#_environment-variables – rioV8 Nov 21 '20 at 16:07
  • @rioV8 that is working, `${env:USERNAME}`, thanks! If you turn it to an answer I'll mark it as solved. – senseiwa Nov 23 '20 at 15:23

1 Answers1

3

You can use Environment variables

The syntax is like ${env:USERNAME}

rioV8
  • 18,123
  • 3
  • 18
  • 35