20

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

Cherona
  • 758
  • 2
  • 10
  • 27
  • 1
    I ran this on my version, and this is your theme (Monokai). I'm afraid there's no way to fix this except changing your theme... :/ – naffetS Oct 19 '19 at 04:14
  • 1
    [https://stackoverflow.com/questions/44219768/disable-italic-syntax-highlighting-in-vs-code](https://stackoverflow.com/questions/44219768/disable-italic-syntax-highlighting-in-vs-code) Yo, go check this one out. –  Oct 19 '19 at 04:14
  • 1
    As ForcX FPV pointed out, https://stackoverflow.com/questions/44219768/disable-italic-syntax-highlighting-in-vs-code – Cherona Oct 19 '19 at 04:58
  • 1
    Does this answer your question? [Disable italic syntax highlighting in VS Code](https://stackoverflow.com/questions/44219768/disable-italic-syntax-highlighting-in-vs-code) – Gino Mempin Jan 15 '20 at 11:36
  • I believe an image is appropriate here, as it's the only way to show the italics within the function signature. @Rob – Cherona Jan 17 '20 at 10:49
  • I'm not sure why @Rob deleted his comment, but he was basically telling me to write it in a code block instead of using a screenshot – Cherona May 18 '20 at 11:44

6 Answers6

17

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

Chris Hayes
  • 11,505
  • 6
  • 33
  • 41
9

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

Hritik Jaiswal
  • 311
  • 3
  • 4
7

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.
Dharman
  • 30,962
  • 25
  • 85
  • 135
Pulkit Banta
  • 181
  • 1
  • 14
6

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

ioneyed
  • 1,052
  • 7
  • 12
Carlo
  • 61
  • 1
  • 3
1

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": ""
         }
      }   
   ]
},
Marvin
  • 647
  • 7
  • 15
-1

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