4N335
4N335

Reputation: 281

How to bold and italic object keys in VS Code?

Is it possible to make the KEYS of our object italic or bold in VSCODE? for example, myObj is an object. Can I change my theme of VSCODE to always show the keys like name , operator and values as italics or bold ? Right now I'm using ONE DARK ITALIC theme.

var myObj = {
  name: 'internalid',
  operator: search.Operator.NONEOF,
  values: empName
};

Upvotes: 1

Views: 801

Answers (1)

Mark
Mark

Reputation: 181639

Assuming this is in a javascript file, try this:

"editor.tokenColorCustomizations": {

  "textMateRules": [  
    {
      "scope": "meta.object-literal.key.js",
      "settings": {
        // "foreground": "#FF0000",
        "fontStyle": "bold"
      }
    }
  ]
}

You can get that scope value by triggering the Developer: Inspect Editor Tokens and Scopes in the command palette. And then click on code of which you want to know the scope. In this case, clicking on a key of an object in a js file yields the scope mete.object-literal.key.js. If you aren't in a js file you'll get a different scope to plug into the textmate rule.

You can also use a fontStyle italic.

Upvotes: 3

Related Questions