Home > Net >  VS Code Syntax Highlighting Mistaking Type?
VS Code Syntax Highlighting Mistaking Type?

Time:09-26

import numpy as np
import matplotlib.pyplot as plt

# INITIAL CONDITIONS
m = 550E03 # kg
r = 3.7 / 2 # m
l = 70 # m

I = m * ( (r ** 2) / 4   (l ** 2) / 12 ) # kg * m^2

position = [0, 0] # m
velocity = [0, 0] # m/s
acceleration = [0, 0] # m/s^2
theta = np.pi / 2 # rad

F_g = [0, -53.935E06] # N
F_R = [80.905E06 * np.cos(theta), 80.905E06 * np.sin(theta)] # N

With this code, VS Code seems to change the color of the variable F_R arbitrarily. I've noticed it does the same for any variable named with the format [Capital Letter]_[Capital Letter]. Any particular idea why this might be the case, and/or how to change this? It is not dependent on VS Code's Color Theme.

enter image description here

CodePudding user response:

As enter image description here Theme: [Abyss]

enter image description here Theme: [Dark High Contrast]

You can customize syntax highlighting in settings.json with the following configuration

"editor.tokenColorCustomizations": {
        "[Default Dark ]": {
            "textMateRules": [
                {
                    "scope": "variable.other.constant",
                    "settings": {
                        "foreground": "#FF0000"
                    }
                }
            ]
        }
    }

enter image description here Theme: [Default Dark ]

  • Related