microsoft / vscode

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

editor.tokenColorCustomizations not applying font style #42939

Closed ghost closed 6 years ago

ghost commented 6 years ago
Extension Author (truncated) Version
vsc-material-theme Equ 1.3.0
vscode-intelephense-client bme 0.8.5
phpunit ema 2.1.1
php-debug fel 1.12.1
composer ika 0.7.1
vs-code-phpunit-snippets jam 0.0.2
php-docblocker nei 1.3.3
java red 0.18.1
open-in-browser tec 1.1.0
vscode-java-debug vsc 0.6.0
vscode-java-pack vsc 0.2.0

(5 theme extensions excluded)


I am not seeing the fontStyle changes I am trying to apply. The Theme I use (Nord Extra Dark) has applied italics in some places, and I am trying to set them to normal instead. I have removed the "fontStyle": "italic" from each of the following yet there is no change in the editor.

Is there a way to do this that will override a theme's choices? It seems simply not setting it is allowing the theme to rule in the case of fontStyle.

Steps to Reproduce:

  1. Add the following to the settings:
    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": [
                    "variable.language.php"
                ],
                "settings": {
                    "foreground": "#bf616a",
                }
            },
            {
                "scope": [
                    "variable.language.this.php"
                ],
                "settings": {
                    "foreground": "#bf616a",
                }
            },
            {
                "scope": [
                    "variable.language.this.php"
                ],
                "settings": {
                    "foreground": "#bf616a",
                }
            }
        ]
    },
  1. Save and close -> open VS Code, as looking at it on-the-fly has no change. Still no change in this case either.
usernamehw commented 6 years ago

Can you try to set "fontStyle": ""?

ghost commented 6 years ago

You know, I just found that out as you typed the comment. Thank you!

I feel this whole area is lacking in documentation, as the hint if you type an incorrect value doesn't mention leaving it empty to override it.

usernamehw commented 6 years ago

Seems logical to me to override only specified properties.

Validation probably disabled because values can be compound: "bold underline", "italic underline bold"...

Some documentation is there: https://code.visualstudio.com/docs/extensions/themes-snippets-colorizers#_textmate-theme-rules https://code.visualstudio.com/blogs/2017/02/08/syntax-highlighting-optimizations#_textmate-themes

usernamehw commented 6 years ago

Probably can be validated against list:

""
"bold"
"underline"
"italic"
"bold italic"
"italic bold"
"bold underline"
"underline bold"
"italic underline"
"underline italic"
"bold italic underline"
"italic bold underline"
"underline bold italic"
"bold underline italic"
"italic underline bold"
"underline italic bold"
alexdima commented 6 years ago

fontStyle is an optional property. So it is valid to skip it. Skipping it means that you do not wish to overwrite the font style (i.e. you go with the settings defined in the theme). The same applies for foreground, it is optional. Skipping it means that you do not wish to overwrite the color.

@aeschli For the schema considerations.

aeschli commented 6 years ago

I will update the description for the property to mention the empty string. Note that we already document and validate all valid values: image

ghost commented 6 years ago

Thanks all.

formspoint commented 6 years ago

Why can't we change the fontFamily here? For example, I'd like to change the comparison operator to font Fira Code in order to turn on Ligatures just in this spot.

  "editor.tokenColorCustomizations": {
        "[Dark++ Italic]": {
            "textMateRules": [
                {
                    "name": "LigsArrow",
                    "scope": [
                        "keyword.operator.comparison",
                        "meta.block",
                        "meta.arrow",
                        "meta.var.expr",
                        "source"
                    ],
                    "settings": {
                        "foreground": "#FF0000",
                        "fontFamily": "Fira Code"
                    }
                },