Search code examples
pythonvisual-studio-codepylance

VSCode Pylance changed text color


I just installed Pylance on VisualStudioCode, my theme is OneDarkPro.

I can manually set the text color with editor.semanticTokenColorCustomizations in settings.json but I wonder if there is a way to simply keep my previous text color.

This is how my code looked like before installing Pylance:

enter image description here

This is how it looks like now:

enter image description here


Solution

  • This is caused by "Editor semantic highlighting". Please add the following settings to the settings file "settings.json" to turn off semantic highlighting:

    "[python]": {
            "editor.semanticHighlighting.enabled": false,
        },
    

    OneDarkPro and Pylance:

    enter image description here

    Reference: Semantic highlighting colors every variable with same color.