Search code examples
syntax-highlightingvisual-studio-codecolor-scheme

Is there a way to customize the color of the import in JS in VS Code?


I'm trying to change the color of the word after import in JS, in VS Code. I attached a screenshot of what I mean.

Screenshot:

code

What I'm referring to is underlined in red

I didn't find a valid entry in the textMateRules for this.

I'd appreciate some help. Thanks :)


Solution

  • I don't know which flavor of javascript you are using but you can use the following in your settings.json:

    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": "variable.other.readwrite.alias.js",
                "settings": {
                    "foreground": "#FF0000"
                }
            }
        ]
    }
    

    How to know which scopes a given token has

    In your command palette type:

    > Developer: Inspect Editor Tokens and Scopes
    

    This will show a popup of information related to the token at cursor: enter image description here

    You will see applicable scope entries at the bottom for textmate scopes, you can use any of the options listed, but the topmost option is the most specfic option