Skip to content
Advertisement

How to fix pylance syntax highlighting showing wrong color for self and cls python class parameters in VSCode with enabled default theme

I have encountered this issue when I use Pylance and syntax highlighting is enabled for python in the VSCode with default or the visual studio theme.

self and cls parameter are LightSkyBlue color like other parameters before

It should be like this:

should be this

Advertisement

Answer

Added the color code inside of the settings.json file for the default dark theme.

// self and cls color for python
"editor.semanticTokenColorCustomizations": {
    "[Default Dark+]": {
        "rules": {
            "selfParameter": "#569CD6",
            "clsParameter": "#569CD6"
        },
    },
},

These two issues on pylance and vscode github repository helped:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement