'How can I disable italics in VSCode?

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



Solution 1:[1]

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

Solution 2:[2]

there is an issue open on Github with a workaround: https://github.com/Microsoft/vscode/issues/32579#issuecomment-341502559

You can be more granular and narrow down the list of scopes if you know which one you want to change. To get the list of scopes use "Developer: Inspect Editor tokens and scopes" from the Command Palette (Ctrl+Shift+p)

Screenshot of Textmate Scopes

Solution 3:[3]

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.

Solution 4:[4]

Just add this to the settings.json

https://gist.github.com/pauldan/f3dbb3e33ee00acc36ad28c9e1de1bf9

This will work on any theme ?

Reference: Reddit - Remove italic from VS Code theme

Solution 5:[5]

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

Solution 6:[6]

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": ""
         }
      }   
   ]
},

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Chris Hayes
Solution 2 ioneyed
Solution 3 Dharman
Solution 4 Hritik Jaiswal
Solution 5 david chandra
Solution 6 Marvin