Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 843
Cherona Avatar asked Oct 19 '19 04:10

Cherona


People also ask

How do I disable italic fonts?

Using either CTRL-I or CTRL-SHIFT-I will turn off italics on your keyboard.

How do I enable italics in VS Code?

type. class. js", //class keyword ], "settings": { "fontStyle": "italic" } }, { "scope": [ //following will be excluded from italics (VSCode has some defaults for italics) "invalid", "keyword.

How do you remove formatting in VS Code?

Every single IDE makes this incredibly difficult. Use vs-code default shortcut keys ctrl+k with ctrl+shift+s (windows) for saving without formatting. Alternatively press ctrl+shift+p and search for save without formatting.

How do you beautify text in VS Code?

The code formatting is available in Visual Studio Code (VSCode) through the following shortcuts or key combinations: On Windows Shift + Alt + F. On macOS Shift + Option + F. On Linux Ctrl + Shift + I.


5 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

like image 93
Chris Hayes Avatar answered Sep 24 '22 21:09

Chris Hayes


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

like image 21
Carlo Avatar answered Sep 23 '22 21:09

Carlo


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.
like image 33
Pulkit Banta Avatar answered Sep 23 '22 21:09

Pulkit Banta


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

like image 45
Hritik Jaiswal Avatar answered Sep 21 '22 21:09

Hritik Jaiswal


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": ""
         }
      }   
   ]
},
like image 40
Maker Avatar answered Sep 23 '22 21:09

Maker