How can I get VS's python syntax highlighting in VS code?

自闭症网瘾萝莉.ら 提交于 2020-12-01 10:15:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!