Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use variables in VS Code settings?

In VS Code settings, there are some fields which I configure the same. These would be namely font and font size. Generally I have them all set to the same. I am trying to set up a variable in the settings.json which can be applied to all of them. After reading through Variables Reference for VS Code, I came up with the following:

{
  "common": [
    {
      "font": "Anonymous Pro",
      "fontSize": 10,
    }
  ],

  // Set up the Editor
  "editor.fontFamily":              "${common:font}",
  "editor.fontSize":                "${common:fontSize}",
  "terminal.integrated.fontFamily": "${common:font}",
  "terminal.integrated.fontSize":   "${common:fontSize}",
  "debug.console.fontFamily":       "${common:font}",
  "debug.console.fontSize":         "${common:fontSize}",
}

Though, this doesn't seem to work. Is there a way to setup variables within the settings.json without having to setup environment variables?

like image 226
lordhog Avatar asked Dec 08 '25 23:12

lordhog


1 Answers

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.

like image 160
lbow Avatar answered Dec 10 '25 23:12

lbow



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!