Environment variables in Linux are supported now in VSCode (although I don't know since when or which version exactly). I have VSCode for Linux 1.73.1.

You can now use the following (just like in the question above):

{
    "java.home": "${env:HOME}/.sdkman/candidates/java/8.0.222.hs-adpt/"
}
Answer from Hechi on Stack Overflow
🌐
GitHub
github.com › microsoft › vscode › issues › 205327
Variables Support in Setting.json · Issue #205327 · microsoft/vscode
February 16, 2024 - Type: Feature Request VS Code settings in Setting.json doesn't support variables(such as ${userHome},${env:USERNAME}). It spoils the experience. Some plugins(such as Run Terminal Command) support environment variables in settings.json. V...
Author   xiaoxstz
Discussions

Environment Variable interpolation in settings.json
Describe the problem VSCode does not resolve env vars in settings.json - this is left for extensions to implement themselves. For example, in the following ${env:BAR} will not be replaced: # .vscod... More on github.com
🌐 github.com
3
August 5, 2022
Support using environment variables in settings.json
VSCode Version: 1.2.1 OS Version: Windows 10 (1511) It would be nice to be able to use environment variables in paths in settings.json, this is not possible in build 1.2.1 and older. In my scenarii... More on github.com
🌐 github.com
3
July 6, 2022
environment variables no longer valid in workspace settings.json or tasks.json
There was an error while loading. Please reload this page · Does this issue occur when all extensions are disabled?: Yes More on github.com
🌐 github.com
12
April 4, 2019
Using environmental variable in settings.json
settings.json in this example literally only stores the string literal for that key. JSON inherently has no logic. It's up to whatever extension that is ingesting the value to do any potential interpolation. More on reddit.com
🌐 r/vscode
2
2
January 2, 2025
🌐
GitHub
github.com › microsoft › vscode › issues › 114515
`${env:VARIABLE}` not work sometimes in `settings.json` · Issue #114515 · microsoft/vscode
January 18, 2021 - So why VS Code did not recognize the JAVA_HOME variable? ... In settings.json, set java.configuration.maven.userSettings to ${env:M2_HOME}\\conf\\settings.xml, and M2_HOME="D:\Program Files\maven".
Author   woobhurk
🌐
GitHub
github.com › golang › vscode-go › issues › 2395
Environment Variable interpolation in settings.json · Issue #2395 · golang/vscode-go
August 5, 2022 - # .vscode/settings.json { "go.testEnvVars": { "FOOBAR": "foo ${env:BAR}" }, } Describe the solution you'd like Strings of the form ${env:FOOBAR} should be replaced with the environment variable value. Describe alternatives you've considered You'd think this should be implemented in VSCode but that's not going to happen.
Author   hrobertson
🌐
GitHub
github.com › microsoft › vscode › issues › 8147
Support using environment variables in settings.json · Issue #8147 · microsoft/vscode
July 6, 2022 - It would be nice to be able to use environment variables in paths in settings.json, this is not possible in build 1.2.1 and older. In my scenariio I`m syncing VS Code settings between computers, for example: // Specifies the path to a PowerShell Script Analyzer settings file. Use either an absolute path (to override the default settings for all projects) or use a path relative to your workspace. "powershell.scriptAnalysis.settingsPath": "%home%.vscode\PSScriptAnalyzerSettings.psd1"
Author   janegilring
🌐
GitHub
github.com › Microsoft › vscode › issues › 43351
Possible to support variables in settings.json? · Issue #43351 · microsoft/vscode
Maven stores downloaded JARs to ~/.m2. On Linux ~ expands to /home/username, while on MacOS it expands to /Users/user.name. Now if I could use an environment variable in the settings.json file, I could keep the setting platform agnostic in the form of ${env:HOME}/.m2/path/to/lombok.jar
Author   ghost
🌐
GitHub
github.com › microsoft › vscode › issues › 71740
environment variables no longer valid in workspace settings.json or tasks.json · Issue #71740 · microsoft/vscode
April 4, 2019 - VSCode Version: 1.33.0 OS Version: Ubuntu 18.0.4 Steps to Reproduce: put some variables in EG: ${env:PATH} "terminal.integrated.env.linux": { "DATA": "${env:PATH};${workspaceFolder}/xtensa-esp32-elf/bin", } echo out that variable in the ...
Author   sebirdman
Find elsewhere
🌐
Reddit
reddit.com › r/vscode › using environmental variable in settings.json
r/vscode on Reddit: Using environmental variable in settings.json
January 2, 2025 -

Could anyone tell me why this doesn't work?

{
    "roc-lang.language-server.exe": "${env:ROC_LANGUAGE_SERVER_PATH}",
    // If you'd like to format Roc files on save
    "editor.formatOnSave": true
}

This is in the workspace settings.json for a project. When I look at the plugin's output, it's treating that exact string as the path, rather than resolving it to the value of the environmental variable. A few other things to note:

  1. If I instead use the literal string that is the value of the variable, it works fine.

  2. I am able to echo that variable in vs code's terminal, so I know it's available.

  3. I am on on linux with a reasonably recent version of vs code.

Thanks.

EDIT: Maybe this is just a limitation of the roc language plugin, that it isn't programmed to resolve the variable?

🌐
GitHub
github.com › microsoft › vscode-python › issues › 20599
my settings.json file can't read variables in my .env file. · Issue #20599 · microsoft/vscode-python
January 31, 2023 - I am trying to override the default python interpreter for a specific workspace. I have created a .vscode directory in the folder with the following two files: .vscode/settings.json: { "python.envFile": "${workspaceFolder}/.vscode/.env",...
Author   xxc-zsz
🌐
Steve Kinney
stevekinney.com › courses › visual studio code › controlling settings with environment variables in visual studio code
Controlling Settings with Environment Variables in Visual Studio Code | Visual Studio Code | Steve Kinney
March 17, 2026 - You can reference environment variables in settings.json using the ${env:VARIABLE_NAME} syntax. { "terminal.integrated.defaultProfile.windows": "${env:WSL_DISTRO_NAME}", // Use WSL distro name as default terminal profile on Windows ...
🌐
Visual Studio Code
code.visualstudio.com › docs › reference › variables-reference
Variables reference
November 3, 2021 - The predefined variables are supported in a select number of setting keys in settings.json files such as the terminal cwd, env, shell and shellArgs values.
🌐
GitHub
github.com › microsoft › vscode-dotnettools › issues › 1544
How to set environment variables in launch.json? · Issue #1544 · microsoft/vscode-dotnettools
October 17, 2024 - microsoft / vscode-dotnettools Public · Notifications · You must be signed in to change notification settings · Fork 39 · Star 287 · New issueCopy link · New issueCopy link · Closed · Closed · How to set environment variables in launch.json?#1544 · Copy link · Assignees ·
Author   lucasmsoares96
🌐
Orchestra
getorchestra.io › guides › using-os-environ-with-local-settings-in-vs-code-settings-json
Using os.environ with Local Settings in VS Code settings.json | Orchestra
March 22, 2025 - By leveraging os.environ, you can reference environment variables from within your code or settings files, keeping your sensitive information out of reach from version control. VS Code allows developers to customize their workspace configuration through settings.json.
🌐
GitHub
github.com › microsoft › vscode › issues › 2809
Support variables when resolving values in settings · Issue #2809 · microsoft/vscode
February 9, 2016 - In a team environment, I'd like to put that setting in our project, something like: .vscode/settings.json: { "typescript.tsdk": "%APPDATA%/npm/node_modules/typescript/lib" } The problem is restarting VS Code results in an error: The path c:\Projects\Derp\%APPDATA%\npm\node_modules\typescript\lib doesn't point to a valid tsserver install.
Author   OlsonDev
🌐
Reddit
reddit.com › r/vscode › my settings.json file can't read variables in my .env file.
r/vscode on Reddit: my settings.json file can't read variables in my .env file.
January 27, 2023 -

I am trying to override the default python interpreter for a specific workspace. I have created a .vscode directory in the folder with the following two files:

settings.json:

{
    "python.envFile": "${workspaceFolder}/.vscode/.env",
    "python.defaultInterpreterPath": "${env:MY_PYTHON_PATH}/bin/python",
}

.vscode/.env:

MY_PYTHON_PATH=/path/to/my/python/interpreter

But the python interpreter is actually getting set to /bin/python - which implies that ${env:MY_PYTHON_PATH} is just empty.

Any ideas what is going wrong here?

🌐
Visual Studio Code
code.visualstudio.com › remote › advancedcontainers › environment-variables
Environment variables
November 3, 2021 - If you have a large number of environment variables that you need to set, you can use a .env file instead. First, create an environment file somewhere in your source tree. Consider this .devcontainer/devcontainer.env file: YOUR_ENV_VAR_NAME=your-value-goes-here ANOTHER_ENV_VAR_NAME=your-value-goes-here · Next, depending on what you reference in devcontainer.json:
Top answer
1 of 5
13

Currently you cannot set variables in the settings.json file.

The current open issue for VS Code to implement this feature is here: https://github.com/microsoft/vscode/issues/2809

It has yet to have a PR and the opening of the issue occurred Feb 2016, but with comments within the last 2 months.

2 of 5
3

Quoting from the same docs which were linked in the question post (asker just needed to scroll down) https://code.visualstudio.com/docs/editor/variables-reference#_is-variable-substitution-supported-in-user-and-workspace-settings :

Is variable substitution supported in User and Workspace settings?

The predefined variables are supported in a select number of setting keys in settings.json files such as the terminal cwd, env, shell and shellArgs values. Some settings like window.title have their own variables:

"window.title": "${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}"

Refer to the comments in the Settings editor (Ctrl+,) to learn about setting specific variables.

Even quoting from the very first sentence in that entire document:

Visual Studio Code supports variable substitution in Debugging and Task configuration files as well as some select settings. Variable substitution is supported inside some key and value strings in launch.json and tasks.json files using ${variableName} syntax.

If you want to be able to use variables freely in settings.json, then see Support variables when resolving values in settings #2809, give it a thumbs up to show support for it, and subscribe to it to get notified about discussion and progress. Please avoid making comments there like "+1" / "bump" / "still not implemented??!!1?!?1".

🌐
Donjayamanne
donjayamanne.github.io › pythonVSCodeDocs › docs › python-path
Python Path and Version | Python in Visual Studio Code
Unfortunately use of relative paths when configuring the interpreter in settings.json will not work with the debugger. Hence the solution is to provide the fully qualified path. This could be achieved with the use of simple variables such as the following: Where ${workspaceRoot} resolves to the current work space (project) directory. { "python.pythonPath": "${workspaceRoot}/venv/bin/python" } Similar to the use of ${workspaceRoot}, environment variables could be used in configuring the path to the python interpreter.
🌐
GitHub
github.com › anthropics › claude-code › issues › 21926
VSCode extension doesn't read env variables from ~/.claude/settings.json · Issue #21926 · anthropics/claude-code
January 30, 2026 - When launching VSCode from Dock, the extension shows the login screen instead of entering chat mode, even though ANTHROPIC_API_KEY and ANTHROPIC_BASE_URL are configured in settings.json. ... The extension should read env variables from ~/.claude/settings.json and enter chat mode directly. Setting system-level environment variables via launchctl setenv works, but this shouldn't be necessary.
Author   vincent4j
🌐
Visual Studio Code
code.visualstudio.com › docs › getstarted › settings
User and workspace settings
February 6, 2025 - You can access the workspace settings ... Linux Ctrl+,)) Select the Preferences: Open Workspace Settings (JSON) command in the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P))...