How can I disable italics in VSCode?

Viewed 18516

I'm writing some python script in VSCode, and I noticed that it's displaying function arguments text in italics

For example

enter image description here

I like the colour, but why is "key" written in italics? I searched all of VSCode settings and couldn't find it - maybe it's the Python extension that's doing this? But I couldn't find settings for that either

6 Answers

Until VSCode adds that setting, the workaround is to add this to the settings.json:

    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": [
                    "comment",
                    "punctuation.definition.comment",
                ],
                "settings": {
                    "fontStyle": ""
                }
            }
        ]
    },

That setting manually uses '' for the font-style on comments. Additional scopes may be required depending on where your theme uses italics.

Answer comes from this GitHub issue thread: https://github.com/Microsoft/vscode/issues/32579#issuecomment-813005373

If you are using an extension for the theme in vscode. Then follow these steps.

  • Ctrl/cmd + shift + x -> search extension eg one dark pro.

enter image description here

  • Click the settings icon and select Extension settings.

enter image description here

  • Toggle italics.

enter image description here

  • Reload your window.

On the latest version of VSCode, it works on me when I set the scope = ['keyword.control'] and settings.fontStyle = '', instead of putting all configs in the scope that didnt related to your concerns

"editor.tokenColorCustomizations": {
   "textMateRules": [
      {
         "scope": [
            "keyword.control",
         ],
         "settings": {
            "fontStyle": ""
         }
      }   
   ]
},

its because the monokai theme's. change other theme (like the vscode default theme) should solve the problem

Related