microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.66k stars 29.43k forks source link

[themes] Disable Italic Option Feature Request #32579

Open carpet92 opened 7 years ago

carpet92 commented 7 years ago

Steps to Reproduce:

1. 2.

Reproduces without extensions: Yes/No

Sometimes authors of themes use italic for comments, language keywords and for other things. In some cases that's looks not so good (as example what I mean you can read my issue/feature-request on Material Theme https://github.com/equinusocio/vsc-material-theme/issues/81). Of course we can change this in theme source code manually but it will be great to have Disable Italic Option in vscode config file.

For example in Sublime Text 3 we have no_italic font option to disable italic at all:

"font_options":
[
    "no_italic"
],

Related issue: https://github.com/Microsoft/vscode/issues/25895

Fira Code don't have Italic too.

tinymins commented 7 years ago

+1

alexdima commented 7 years ago

@aeschli

Would this be something doable via user settings? (since those rules get appended to the theme rules anyways?)

Korvox commented 7 years ago

I ran into this issue with the Atom One theme, and adding the following setting worked for me:

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

So for anyone that wants "normal" font styling on comments, just drop that in your settings.

carpet92 commented 7 years ago

@Korvox thanks. That's helpful for me:

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

"punctuation.definition.comment" to disable italic on the characters that creating comments (like: // and others).

mohouyizme commented 7 years ago

It's not a dynamic way but add those lines to your vs code settings:

"editor.tokenColorCustomizations": {
  "textMateRules": [
    {
      "scope": [
        "comment",
        "comment.block",
        "comment.block.documentation",
        "comment.line",
        "constant",
        "constant.character",
        "constant.character.escape",
        "constant.numeric",
        "constant.numeric.integer",
        "constant.numeric.float",
        "constant.numeric.hex",
        "constant.numeric.octal",
        "constant.other",
        "constant.regexp",
        "constant.rgb-value",
        "emphasis",
        "entity",
        "entity.name",
        "entity.name.class",
        "entity.name.function",
        "entity.name.method",
        "entity.name.section",
        "entity.name.selector",
        "entity.name.tag",
        "entity.name.type",
        "entity.other",
        "entity.other.attribute-name",
        "entity.other.inherited-class",
        "invalid",
        "invalid.deprecated",
        "invalid.illegal",
        "keyword",
        "keyword.control",
        "keyword.operator",
        "keyword.operator.new",
        "keyword.operator.assignment",
        "keyword.operator.arithmetic",
        "keyword.operator.logical",
        "keyword.other",
        "markup",
        "markup.bold",
        "markup.changed",
        "markup.deleted",
        "markup.heading",
        "markup.inline.raw",
        "markup.inserted",
        "markup.italic",
        "markup.list",
        "markup.list.numbered",
        "markup.list.unnumbered",
        "markup.other",
        "markup.quote",
        "markup.raw",
        "markup.underline",
        "markup.underline.link",
        "meta",
        "meta.block",
        "meta.cast",
        "meta.class",
        "meta.function",
        "meta.function-call",
        "meta.preprocessor",
        "meta.return-type",
        "meta.selector",
        "meta.tag",
        "meta.type.annotation",
        "meta.type",
        "punctuation.definition.string.begin",
        "punctuation.definition.string.end",
        "punctuation.separator",
        "punctuation.separator.continuation",
        "punctuation.terminator",
        "storage",
        "storage.modifier",
        "storage.type",
        "string",
        "string.interpolated",
        "string.other",
        "string.quoted",
        "string.quoted.double",
        "string.quoted.other",
        "string.quoted.single",
        "string.quoted.triple",
        "string.regexp",
        "string.unquoted",
        "strong",
        "support",
        "support.class",
        "support.constant",
        "support.function",
        "support.other",
        "support.type",
        "support.type.property-name",
        "support.variable",
        "variable",
        "variable.language",
        "variable.name",
        "variable.other",
        "variable.other.readwrite",
        "variable.parameter"
      ],
      "settings": {
        "fontStyle": ""
      }
    }
  ]
}
hrvoj3e commented 6 years ago

Just like to add some references for others who want to override specific language or theme style setting.

@mohouyizme covered a lot of scopes but I wanted to override language specific only and not use all of them atm.

gibbok commented 6 years ago

@mohouyizme Great snippet!

In your configurations all italics are disabled expect when importing a "module", example the word "data" in the following snippet for a .tsx file is still in italic.

import { data as scrapReasons } from './testData -----------^^-- italic

What is the right configuration to set that font to "normal" style too? Thanks!

capture

mohouyizme commented 6 years ago

@gibbok I know it's not the best way to do things but add this line to the list above Microsoft/vscode#32579 (comment)

"meta.import variable.other.readwrite"
mohouyizme commented 6 years ago

Here is a simple way to find the scopes to add them to this list:

"editor.tokenColorCustomizations": {
  "textMateRules": [
    {
      "scope": [
         // Add scopes name to this array
      ],
      "settings": {
        "fontStyle": ""
      }
    }
  ]
}

First focus your mouse on the italic or bold word:

screenshot_1

Then open the Command Palette

screenshot_2

Search for: "Developer: Inspect TM Scopes"

screenshot_3

It will appear a popup contains some information about the scope

screenshot_5

Add the highlighted part to the scope array mentioned above

"editor.tokenColorCustomizations": {
  "textMateRules": [
    {
      "scope": [
         "meta.import variable.other.readwrite",
         "other scopes ..."
      ],
      "settings": {
        "fontStyle": ""
      }
    }
  ]
}

Finally you can find me on twitter: @mohouyizme

GIF

ayaorei commented 6 years ago

@mohouyizme so do i just paste the code on the user settings? or do i need to put fontstyle? I know iam big noob...

kelset commented 6 years ago

@ayaorei yes, basically you can simply copy any variation of @mohouyizme's snippet into your User Preferences and you are good to go :)

ayaorei commented 6 years ago

@mohouyizme @kelset thank you so much. it work.

if-jds commented 5 years ago

This popped up yesterday in Material Theme after an upgrade to 1.31.1. All of the sudden every class in my SCSS files became italicized. Instead of slowly losing my mind throughout the day, this post helped me write this settings block:

    "editor.tokenColorCustomizations": {
        "textMateRules": [{
            "scope": [
                "entity.other.attribute-name",
            ],                
            "settings":{
                "fontStyle": ""
            }
        }]
    }

That's the scope if you're running into weird italicized classes!

gdmachado commented 5 years ago

On the spirit of doing it the hacky way, a better solution I found is, instead of adding every single scope to editor.tokenColorCustomizations, you can use the vscode-custom-css extension, and then set this in your custom css file:

.mtki {
    font-style: normal;
}

It will apply to every single scope if that's what you're looking for.

kiwi0fruit commented 5 years ago

Is there a way to only prevent terrible auto-slant but have italics when the font has them? For example in cases when the main font has italics but fallback CJK font does not?

SNikalaichyk commented 4 years ago

+1

theAkito commented 4 years ago

Interesting and sad at the same time, how so many workarounds accumulated over time and yet no real fix seems to be implemented in the software, itself, even after roughly 3 years. :/

fuadnafiz98 commented 4 years ago

Maybe should make a extension that overwrite the settings.json 😞

suptejas commented 4 years ago

Hey guys,

I have disabled it in the settings.json however, it still hasn't worked:

{
    "[dart]": {
        "editor.trimAutoWhitespace": false,
        "editor.autoClosingBrackets": "always",
        "diffEditor.ignoreTrimWhitespace": true,
        "editor.formatOnSave": true,
        "editor.formatOnType": true,
        "editor.rulers": [
            80
        ],
        "editor.selectionHighlight": false,
        "editor.suggest.snippetsPreventQuickSuggestions": false,
        "editor.suggestSelection": "first",
        "editor.tabCompletion": "onlySnippets",
        "editor.wordBasedSuggestions": false
    },
    "editor.fontFamily": "Cascadia Code",
    "window.zoomLevel": 1.5,
    "workbench.iconTheme": "material-icon-theme",
    "terminal.integrated.fontSize": 15,
    "terminal.integrated.cursorStyle": "line",
    "explorer.confirmDelete": false,
    "files.autoSaveDelay": 300,
    "editor.fontLigatures": true,
    "git.enableSmartCommit": true,
    "[json]": {
        "editor.quickSuggestions": {
            "strings": true
        },
        "editor.suggest.insertMode": "replace"
    },
    "editor.fontSize": 20,
    "editor.minimap.enabled": false,
    "python.pythonPath": "/usr/local/opt/python@3.8/bin/python3.8",
    "editor.suggestSelection": "first",
    "python.languageServer": "Microsoft",
    "kite.showWelcomeNotificationOnStartup": false,
    "python.linting.enabled": true,
    "editor.defaultFormatter": "Dart-Code.dart-code",
    "editor.formatOnSave": true,
    "explorer.confirmDragAndDrop": false,
    "dart.previewBazelWorkspaceCustomScripts": true,
    "dart.previewFlutterUiGuides": true,
    "dart.previewFlutterUiGuidesCustomTracking": true,
    "scm.inputFontFamily": "defaultSF Mono",
    "python.dataScience.askForKernelRestart": false,
    "files.autoSave": "afterDelay",
    "python.dataScience.alwaysTrustNotebooks": true,
    "cSpell.userWords": [
        "sqlite"
    ],
    "git.confirmSync": false,
    "editor.fontWeight": "300",
    "editor.tokenColorCustomizations": {
        "scope": [
            "comment",
            "comment.block",
            "comment.block.documentation",
            "comment.line",
            "constant",
            "constant.character",
            "constant.character.escape",
            "constant.numeric",
            "constant.numeric.integer",
            "constant.numeric.float",
            "constant.numeric.hex",
            "constant.numeric.octal",
            "constant.other",
            "constant.regexp",
            "constant.rgb-value",
            "emphasis",
            "entity",
            "entity.name",
            "entity.name.class",
            "entity.name.function",
            "entity.name.method",
            "entity.name.section",
            "entity.name.selector",
            "entity.name.tag",
            "entity.name.type",
            "entity.other",
            "entity.other.attribute-name",
            "entity.other.inherited-class",
            "invalid",
            "invalid.deprecated",
            "invalid.illegal",
            "keyword",
            "keyword.control",
            "keyword.operator",
            "keyword.operator.new",
            "keyword.operator.assignment",
            "keyword.operator.arithmetic",
            "keyword.operator.logical",
            "keyword.other",
            "markup",
            "markup.bold",
            "markup.changed",
            "markup.deleted",
            "markup.heading",
            "markup.inline.raw",
            "markup.inserted",
            "markup.italic",
            "markup.list",
            "markup.list.numbered",
            "markup.list.unnumbered",
            "markup.other",
            "markup.quote",
            "markup.raw",
            "markup.underline",
            "markup.underline.link",
            "meta",
            "meta.block",
            "meta.cast",
            "meta.class",
            "meta.function",
            "meta.function-call",
            "meta.preprocessor",
            "meta.return-type",
            "meta.selector",
            "meta.tag",
            "meta.type.annotation",
            "meta.type",
            "punctuation.definition.string.begin",
            "punctuation.definition.string.end",
            "punctuation.separator",
            "punctuation.separator.continuation",
            "punctuation.terminator",
            "storage",
            "storage.modifier",
            "storage.type",
            "string",
            "string.interpolated",
            "string.other",
            "string.quoted",
            "string.quoted.double",
            "string.quoted.other",
            "string.quoted.single",
            "string.quoted.triple",
            "string.regexp",
            "string.unquoted",
            "strong",
            "support",
            "support.class",
            "support.constant",
            "support.function",
            "support.other",
            "support.type",
            "support.type.property-name",
            "support.variable",
            "variable",
            "variable.language",
            "variable.name",
            "variable.other",
            "variable.other.readwrite",
            "variable.parameter",
            "source.dart",
          ],
          "settings": {
            "fontStyle": ""
          }
    },
    "workbench.colorTheme": "Dracula"
}

However,

When I go back to my editor:

Screenshot 2020-08-08 at 10 05 58 AM

Here is what to developer token option tells me: Screenshot 2020-08-08 at 10 07 07 AM

I appreciate your help. Thanks!

fuadnafiz98 commented 4 years ago

don't know working fine for me with same settings.json :| Screenshot from 2020-08-08 12-38-12

mrillusi0n commented 4 years ago

I'm sorry, why hasn't this been fixed yet?

mohouyizme commented 4 years ago

@mrillusi0n I'm not sure if it's a problem in the first place, the font styles mainly come with themes, you may open an issue or even contribute to your favorite theme and add a variant that comes without font styles, or you can use the snippet above.

mrillusi0n commented 4 years ago

Yes, sorry about that. Now that I think about it, if the devs kept on adding every feature that was requested... 😵 BLOAAATSSS.

libertypi commented 3 years ago

Instead of adding hundreds of lines to my settings.json, I feel it is easier for me to modify the themes. So I write a dirty python script to do it. The script delete all the italic fonts in themes. But you have to run it every time the theme get updated.

#!/usr/bin/env python3

import json
import os
import re
from pathlib import Path

# the `extensions` dir of your vscode profile,
# in Linux or macOS, this should be:
# extdir = Path("~/.vscode/extensions").expanduser()
# in WSL, should be like this:
extdir = Path("/mnt/c/Users/USERNAME/.vscode/extensions")

# the folder name of the themes you want to modify,
# without version numbers
themes = (
    "equinusocio.vsc-material-theme",
    "equinusocio.vsc-community-material-theme",
    "dracula-theme.theme-dracula",
)

def modify_json(themedir: Path):

    with open(themedir.joinpath("package.json"), "r", encoding="utf-8") as f:
        files = [
            themedir.joinpath(d["path"])
            for d in json.load(f)["contributes"]["themes"]
        ]

    for file in files:
        with open(file, "r+", encoding="utf-8") as f:
            data = json.load(f)
            for colors in data["tokenColors"]:
                settings = colors["settings"]
                font = settings.get("fontStyle", "")
                if "italic" in font:
                    font = re.sub(r"\s*italic\s*", "", font)
                    if font:
                        settings["fontStyle"] = font
                    else:
                        del settings["fontStyle"]
            f.seek(0)
            json.dump(data, f, indent=4, ensure_ascii=False)
            f.truncate()

def main():
    pattern = re.compile(rf'({"|".join(themes)})-[\d.]+', re.I)
    for name in filter(pattern.fullmatch, os.listdir(extdir)):
        modify_json(extdir.joinpath(name))
        print(f"{name} modified.")

if __name__ == "__main__":
    main()
admirabilis commented 3 years ago

Please, if this is ever implemented, I would like an option for disabling bold text too!

demeralde commented 3 years ago

I'm surprised this still isn't a setting, it's a rudimentary feature. Having to manually set the fontStyle for every single scope is a bit of a pain.

zaydek commented 3 years ago

@dspacejs This might help.

This was enough for me:

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

Sometimes comment alone isn’t enough.

The problem is that italics are theme-specific. That being said, you can also override scopes but note this approach is also theme-specific.

This comment explains how to work out how to determine specifically which scopes to use so you don’t have to be exhaustive.

demeralde commented 3 years ago

@zaydek that's cleaner, but users should only have to create a complex configuration if they're looking to only italicise certain nodes. I don't want any italics at all, and I'm guessing there's many users who don't.

sana-ajani commented 3 years ago

I wonder, could we implement this as a command so it's easier for users to accomplish? I received feedback from a user that italics are difficult and not very readable for visually impaired users (latest comments on the Dracula theme repo: https://github.com/dracula/visual-studio-code/issues/78). Ideally, all users should be able to use themes without text formatting, instead of having theme authors built alternate versions?

cc @isidorn adding accessibility label to this

jeffteixeira commented 3 years ago

Any news?

igdev116 commented 3 years ago

How can I turn off italic font of VS code destructuring? Thanks a lot! 🎅 image

amanov-begli commented 2 years ago

Instead of adding hundreds of lines to my settings.json, I feel it is easier for me to modify the themes. So I write a dirty python script to do it. The script delete all the italic fonts in themes. But you have to run it every time the theme get updated.

#!/usr/bin/env python3

import json
import os
import re
from pathlib import Path

# the `extensions` dir of your vscode profile,
# in Linux or macOS, this should be:
# extdir = Path("~/.vscode/extensions").expanduser()
# in WSL, should be like this:
extdir = Path("/mnt/c/Users/USERNAME/.vscode/extensions")

# the folder name of the themes you want to modify,
# without version numbers
themes = (
    "equinusocio.vsc-material-theme",
    "equinusocio.vsc-community-material-theme",
    "dracula-theme.theme-dracula",
)

def modify_json(themedir: Path):

    with open(themedir.joinpath("package.json"), "r", encoding="utf-8") as f:
        files = [
            themedir.joinpath(d["path"])
            for d in json.load(f)["contributes"]["themes"]
        ]

    for file in files:
        with open(file, "r+", encoding="utf-8") as f:
            data = json.load(f)
            for colors in data["tokenColors"]:
                settings = colors["settings"]
                font = settings.get("fontStyle", "")
                if "italic" in font:
                    font = re.sub(r"\s*italic\s*", "", font)
                    if font:
                        settings["fontStyle"] = font
                    else:
                        del settings["fontStyle"]
            f.seek(0)
            json.dump(data, f, indent=4, ensure_ascii=False)
            f.truncate()

def main():
    pattern = re.compile(rf'({"|".join(themes)})-[\d.]+', re.I)
    for name in filter(pattern.fullmatch, os.listdir(extdir)):
        modify_json(extdir.joinpath(name))
        print(f"{name} modified.")

if __name__ == "__main__":
    main()

This works for perfectly! Thank you so much!!! And be well!

chairmanbrando commented 2 years ago

It's bananas that this is still an issue FIVE YEARS after this feature request was opened! 💀

A word of caution for Google visitors: @libertypi's script doesn't seem to work for themes with C-style comments in their JSON. This was all the ones I tried, e.g. Wes Bos's Cobalt2, on my Mac. Python's built-in JSON parser doesn't seem to support such comments. :c

Pasynko commented 2 years ago

It's not a dynamic way but add those lines to your vs code settings:


"editor.tokenColorCustomizations": {
  "textMateRules": [
    {
      "scope": [
        "comment",
        "comment.block",
        "comment.block.documentation",
        "comment.line",
        "constant",
        "constant.character",
        "constant.character.escape",
        "constant.numeric",
        "constant.numeric.integer",
        "constant.numeric.float",
        "constant.numeric.hex",
        "constant.numeric.octal",
        "constant.other",
        "constant.regexp",
        "constant.rgb-value",
        "emphasis",
        "entity",
        "entity.name",
        "entity.name.class",
        "entity.name.function",
        "entity.name.method",
        "entity.name.section",
        "entity.name.selector",
        "entity.name.tag",
        "entity.name.type",
        "entity.other",
        "entity.other.attribute-name",
        "entity.other.inherited-class",
        "invalid",
        "invalid.deprecated",
        "invalid.illegal",
        "keyword",
        "keyword.control",
        "keyword.operator",
        "keyword.operator.new",
        "keyword.operator.assignment",
        "keyword.operator.arithmetic",
        "keyword.operator.logical",
        "keyword.other",
        "markup",
        "markup.bold",
        "markup.changed",
        "markup.deleted",
        "markup.heading",
        "markup.inline.raw",
        "markup.inserted",
        "markup.italic",
        "markup.list",
        "markup.list.numbered",
        "markup.list.unnumbered",
        "markup.other",
        "markup.quote",
        "markup.raw",
        "markup.underline",
        "markup.underline.link",
        "meta",
        "meta.block",
        "meta.cast",
        "meta.class",
        "meta.function",
        "meta.function-call",
        "meta.preprocessor",
        "meta.return-type",
        "meta.selector",
        "meta.tag",
        "meta.type.annotation",
        "meta.type",
        "punctuation.definition.string.begin",
        "punctuation.definition.string.end",
        "punctuation.separator",
        "punctuation.separator.continuation",
        "punctuation.terminator",
        "storage",
        "storage.modifier",
        "storage.type",
        "string",
        "string.interpolated",
        "string.other",
        "string.quoted",
        "string.quoted.double",
        "string.quoted.other",
        "string.quoted.single",
        "string.quoted.triple",
        "string.regexp",
        "string.unquoted",
        "strong",
        "support",
        "support.class",
        "support.constant",
        "support.function",
        "support.other",
        "support.type",
        "support.type.property-name",
        "support.variable",
        "variable",
        "variable.language",
        "variable.name",
        "variable.other",
        "variable.other.readwrite",
        "variable.parameter"
      ],
      "settings": {
        "fontStyle": ""
      }
    }
  ]
}
--.          {
      "support.me"
       "cloud"
}
chairmanbrando commented 2 years ago

@Pasynko I had to add keyword.control.return to that list. I still say it's bananas that we need to add 111 lines to our settings JSON to disable italics instead of checking one box. D:

ghost commented 2 years ago

The solutions above didn't worked for me, I am using Ubuntu 22.04 LTS 64-bit, note that the fonts of integrated terminal are affected:

italic


Edit: what I did was install the flatpak version instead of .deb of official site, that solved the issue.

fastmarketo commented 2 years ago

I implemented the above still it completely didn't get me rid of the italics in the "Dark Theme".

image

Full code in settings.json:

{
    "workbench.colorTheme": "Dark Theme",
    "editor.fontFamily": "Fira Code, Menlo, Monaco, 'Courier New', monospace",
    "editor.fontLigatures": true,
    "terminal.integrated.fontSize": 20,
    "editor.fontSize": 20,
    "editor.tabSize": 2,
    "editor.tokenColorCustomizations": {   
        "textMateRules": [
          {
            "scope": [
              "comment",
              "comment.block",
              "comment.block.documentation",
              "comment.line",
              "constant",
              "constant.character",
              "constant.character.escape",
              "constant.numeric",
              "constant.numeric.integer",
              "constant.numeric.float",
              "constant.numeric.hex",
              "constant.numeric.octal",
              "constant.other",
              "constant.regexp",
              "constant.rgb-value",
              "emphasis",
              "entity",
              "entity.name",
              "entity.name.class",
              "entity.name.function",
              "entity.name.method",
              "entity.name.section",
              "entity.name.selector",
              "entity.name.tag",
              "entity.name.type",
              "entity.other",
              "entity.other.attribute-name",
              "entity.other.inherited-class",
              "invalid",
              "invalid.deprecated",
              "invalid.illegal",
              "keyword",
              "keyword.control",
              "keyword.operator",
              "keyword.operator.new",
              "keyword.operator.assignment",
              "keyword.operator.arithmetic",
              "keyword.operator.logical",
              "keyword.other",
              "markup",
              "markup.bold",
              "markup.changed",
              "markup.deleted",
              "markup.heading",
              "markup.inline.raw",
              "markup.inserted",
              "markup.italic",
              "markup.list",
              "markup.list.numbered",
              "markup.list.unnumbered",
              "markup.other",
              "markup.quote",
              "markup.raw",
              "markup.underline",
              "markup.underline.link",
              "meta",
              "meta.block",
              "meta.cast",
              "meta.class",
              "meta.function",
              "meta.function-call",
              "meta.preprocessor",
              "meta.return-type",
              "meta.selector",
              "meta.tag",
              "meta.type.annotation",
              "meta.type",
              "punctuation.definition.string.begin",
              "punctuation.definition.string.end",
              "punctuation.separator",
              "punctuation.separator.continuation",
              "punctuation.terminator",
              "storage",
              "storage.modifier",
              "storage.type",
              "string",
              "string.interpolated",
              "string.other",
              "string.quoted",
              "string.quoted.double",
              "string.quoted.other",
              "string.quoted.single",
              "string.quoted.triple",
              "string.regexp",
              "string.unquoted",
              "strong",
              "support",
              "support.class",
              "support.constant",
              "support.function",
              "support.other",
              "support.type",
              "support.type.property-name",
              "support.variable",
              "variable",
              "variable.language",
              "variable.name",
              "variable.other",
              "variable.other.readwrite",
              "variable.parameter"
            ],
            "settings": {
              "fontStyle": ""
            }
          }
        ]
      },
    "oneDarkPro.italic": false,
}
geekysaurabh001 commented 1 year ago

2023 and this accessibility issue is still not fixed.

MariuzM commented 1 year ago

For me textMateRules does not work, but this does

  "editor.semanticTokenColorCustomizations": {
    "enabled": true,
    "rules": {
      "*": {
        "italic": false
      },
  },

Tested with Flutter code base and One Dark Pro theme

gma commented 1 year ago

Tested with Flutter code base and One Dark Pro theme

That's awesome @MariuzM, great discovery. I've disabled my textMateRules settings and tested your rule with a few themes. I've had good (but not perfect) results.

Sarah Drasner's "In Bed by 7pm" theme uses italics for a few things, and your new rule disables most of them. I'm still seeing italics for comments though.

With Sarah's Night Owl theme (the version with italics) this new settings removes lots of the italics, but I'm still seeing italics on keyword.control and entity.name.function scopes.

I tried Material Theme Darker too, and that also italicises keyword.control scopes.

I'm going to keep your "italic": false rule, and re-enable my textMateRules setting, which is largely based on the info previously shared in this issue.

So far, I've collected the following additions to the scopes reported by others in this issue:

"constant.language.json.comments",
"constant.language.boolean.false.tsx",
"constant.language.boolean.true.tsx",
"keyword.control.flow.tsx",
"keyword.control.import.tsx",
"keyword.control.return",
"support.type.builtin.tsx",
"variable.other.object",
"variable.other.object.property.tsx",
chairmanbrando commented 1 year ago

I also removed my textMateRules to test @MariuzM's method, and I installed that same "In Bed by 7pm" theme as @gma did. Italics out the wazanus:

Screenshot 2023-07-21 at 5 31 42 PM

...At least in PHP. And, yes, the comments are all italicized too. It's bananas that the Code devs still haven't provided a sane method to turn these off. It shouldn't require adding 700 lines to your settings file!

Smecta commented 1 year ago

以下是查找范围并将其添加到此列表的简单方法:

"editor.tokenColorCustomizations": {
  "textMateRules": [
    {
      "scope": [
         // Add scopes name to this array
      ],
      "settings": {
        "fontStyle": ""
      }
    }
  ]
}

首先将鼠标聚焦在斜体或粗体单词上:

首先将鼠标聚焦在斜体或粗体单词上: 截图_1

然后打开命令面板

然后打开命令面板 截图_2

搜索:“开发人员:Inspect TM Scopes”

搜索:“开发人员:Inspect TM Scopes” 截图_3

将会出现一个弹出窗口,其中包含有关范围的一些信息

将会出现一个弹出窗口,其中包含有关范围的一些信息 截图_5

将突出显示的部分添加到上面提到的范围数组中

将突出显示的部分添加到上面提到的范围数组中

"editor.tokenColorCustomizations": {
  "textMateRules": [
    {
      "scope": [
         "meta.import variable.other.readwrite",
         "other scopes ..."
      ],
      "settings": {
        "fontStyle": ""
      }
    }
  ]
}

最后你可以在 Twitter 上找到我:@mohouyizme

最后你可以在 Twitter 上找到我:@mohouyizme 动图 GIF

image

sad...

debemdeboas commented 1 year ago

This should be considered a basic accessibility feature, not a nitpick by a few developers. Using @MariuzM's solution does improve the situation, but not entirely. And it is also less performant than overriding in a per-token basis. Also this isn't just aimed at italics, but bold and underlines as well.

TLDR: There needs to be a way to globally enable/disable font styling à la the "editor.fontWeight" option. Themes could do this by themselves, leaving it up to the themes' maintainers to add an option for this (catppuccin does this pretty well: "catppuccin.italicKeywords": false); however, leaving it to the developers doesn't seem like the best option - and sometimes it's best to have a global option.

blakewatson commented 8 months ago

I've been using the settings/hack described here for several years now. It’s frustrating because I'm always discovering new scopes that I haven’t covered yet. As an outsider, this feels like a fairly simple "no-brainer" of a setting. But maybe it’s technically tricky for some reason.

Anyway just commenting to add my vote. This setting or a related one should cover bold too.

braebo commented 5 months ago

Some themes seem to override all textMateRules scopes (even *).

Adding this setting (with the apc-extension) is the only way I've managed to disable italics (in comments) for all themes:

"apc.stylesheet": {
    ".mtk8": {
        "font-style": "normal !important",
    }
},

The !important overrides vscode's css for italics, and .mtk8 is the classname used for comments. To target other (non-comment) font, you can use the Toggle Developer Tools command to inspect the classnames of the areas you want to target.

The only downside is that it forces all font-styles like bold to be normal, as opposed to only italic font-styles.

lost22git commented 3 months ago

I just want to disable italic but reset styles

ghost commented 3 months ago

It's August 2024, and I'm still waiting for this

SammySnake-d commented 1 week ago

Maybe you can try this configuration; I can use this configuration to turn italic.

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

Need to change italic to ""