问题
It seems like VS Community with python tools has a better syntax highlighting than VS Code with "Python" by Don Jayamanne. As you can see in the picture attached, VS Community highlights in ¿purple? the packages imported, and lightblue for classes while VS code just don't.
回答1:
I ran into the same issue and some VS Code themes are not supporting syntax highlighting atleast for me. I tried with Ruby and Python and the theme I was using was Dark(Visual Studio).
Changing to Dark+ (Default Dark) did the trick for me.
Goto Preferences -> Color Themes and choose Dark+(Default Dark) or something similar.
Hope it helps.
回答2:
Try MagicPython systax highlighter from extensions.
回答3:
I had problems with syntax highlighting with python in vs code and the solution was that my file name did not end with ".py"
回答4:
I was facing the same issue. I used the Chromodynamics theme which is compatible with MagicPython. You can find it here or install directly in the VS-CODE
https://github.com/MagicStack/Chromodynamics
回答5:
What did the trick for me, was to keep the Window: Auto Detect Color Scheme disabled. Attaching a picture of this checkbox in my answer:
来源:https://stackoverflow.com/questions/45291759/how-can-i-get-vss-python-syntax-highlighting-in-vs-code