Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To italicize certain keywords in Visual Studio Code, you can use the TextMate grammar which allows you to define scopes for different portions of your code.

  1. Open the settings.json file by pressing Ctrl + , (Windows) or Cmd + , (Mac).
  2. Search for "editor.tokenColorCustomizations" in the search bar and click "Edit in settings.json".
  3. In the settings.json file, add the following code:
"editor.tokenColorCustomizations": {
    "textMateRules": [
        {
            "scope": "keyword.control.yourKeywordHere",
            "settings": {
                "fontStyle": "italic"
            }
        },

    ]
}
  1. Replace "yourKeywordHere" with the actual keyword you want to italicize.
  2. Save the settings.json file and the changes will take effect immediately.

Note: You can find the scope of a certain keyword by placing your cursor on the keyword and pressing Ctrl + Shift + P, then typing "Scope" and selecting "Developer: Inspect TM Scopes".