VS Code Python Syntax Highlighting Only Half Working - python

I've been using both VS Code and Sublime for a while now. I mostly do my python coding in Sublime and I have recently decided to try out VS Code. One issue though.
The syntax highlighting for python is not functioning in the manner I would expect. Here is a .py file opened in both VS Code and Sublime for comparison:
Sublime Text:
VS Code:
When comparing the VS Code syntax highlighting to that of Sublime, it appears to only function half correctly.
Tons of stuff that I would expect to receive some form of colored formatting such as function calls, function parameters etc all just appear as white text.
After looking at loads of VS Code python tutorials online, it would definitely seem something is wrong with my setup as everyone else seems to receive function calls/function paramters/etc syntax highlighting.
Troubleshooting progress so far:
I have the VS Code python extension installed.
I've tried uninstalling and reinstalling VS Code.
I've tried uninstalling and reinstalling Python extension.
I've tried installing the magicPython
extension.
Ensuring I have both python2 and python3 installed on my machine
Color theme is currently Dark+, however this behavior occurs with all
color themes.
Made sure the file ends in .py
I'm running on a Mac, if that's relevant.
Any help would be greatly appreciated. Thank you!

i think you just need to change your theme
check this one out https://github.com/sobolevn/dotfiles

Related

Why is VS Code showing "windll Windows only: Creates ()" intellisense suggestions?

While writing Python code on VS Code, it is showing suggestions like:
windll Windows only: Creates ()
I have tried to see if this was coming from snippet extension I might have installed but I don't think I have any... can anyone shine a light on why I am getting his code completion nonsense?
I had this same issue, every time :, ., def, or if is typed, there's annoying suggestions that don't make sense. I found out it's the Python Extended extension that's responsible for this. It seems to be reported on it's GitHub issues page, but for now I would disable the extension as it doesn't seem to be working at all for me. I recommend PyLance as a replacement.
It's the extension problem.
You have installed the extension named: Python Extended inside your vs code and you will need to uninstall it.
It works well on my editor after uninstalling this extension.

VS Code Python Syntax Highlighting

I installed VS Code and have been working on it for a while. I've been facing a small problem. The syntax highlighting for the python code is not working. I'm still not familiar with the setting or if I'm doing something wrong. I have attached an image of the problem.
Heres an image that shows what's wrong
Save your file as a .py so VScode knows it's looking a python file and can highlight the syntax accordingly.

Sublime Text 3 Output Python

I work on two computers, I have Sublime Text 3 and Python 2.7 on both of them.
Recently, without changing any configuration (except maybe installing some packages like ANACONDA for ST3), when I build my python code on Sublime Text 3: e.g.,
print 'Hello world'
Console output is just showing:
[Finished in 0.1s]
And nothing more, (I want to see the printed text), this is quite irritating because for the life of me I can't figure out how to solve this.
A related and perhaps identical problem is experienced by #Jens_Leersen.
I've tried the answer contained in #radioxoma 's answer but to no avail.
Related example
I got that thing as well. You can change it by Tools/Build with and choose "Python" instead of "Python- Syntax Check". It turns out that I clicked "Syntax Check" the first time I try to compile. My dumb mistake costs me a few minutes of panic.
This got fixed by uninstalling python 2.7, and installing Anaconda with python 3.5, then installing anaconda through Package Control.
Use Ctrl+shift+b this will show a box asking you if you want to use Python or Python Syntax Check. Select Python and once you are done you will be able to use Ctrl+b to build you code and see the output at the bottom. this answer is just about the same as #1757 answers right below i am just using shortcuts to get to the same functionality
Thank you #1757
Its simple, press ctrl + shift + b and click on python (not python - syntax check).
Build and Voila!

Visual Python working very slowly

I want to use visual for my project. I've used it many times before and everything was just fine, but I recently changed jobs so am using it on a machine that I've never worked on before
The problem is somewhat peculiar: when I run one of the example scripts from /visual/examples everything is just fine. However when I try to run a very simple script:
import visual
visual.sphere(pos=[0.,0.,0.],radius=1.,color=visual.color.red)
it takes a couple minutes to execute. This is completely unacceptable for the project I want to use it for.
I've tried running this sort of scripts from command line and IPython but the behaviour is the same: a visual window appears, Windows tags the window as "not responding" and then, after some painfully long time, the entire scene appears as expected.
This is clearly not a problem with what IDE I use to call visual and I'm seriously clueless about how to solve this. If that's of any importance I'm using a 64 bit Windows (also downloaded 64b visual) and a Python distribution that comes with Anaconda.
An interesting observation: The Python interpreter from which I run the script is not busy, i.e. I can execute other commands in it while the visual scene is not displaying correctly.
Any help or even ideas on what to do to try and resolve this issue would be very much appreciated.
Do you have either a visual.sleep(pause_time) or visual.rate(frequency) line somewhere in your visualization loop? VPython requires one of these two lines to update the animation window.
I would start from scratch with a base python distribution/implementation.
Try downloading first a stock 64-bit Windows Python-2.7.5 : http://python.org/ftp/python/2.7.5/python-2.7.5.amd64.msi
Then download VPython-Win-64 : http://sourceforge.net/projects/vpythonwx/files/6.05-release/VPython-Win-64-Py2.7-6.05.exe/download
If this doesn't work, then it might be an issue with something other than vpython or anaconda.
If you can get it to work properly, then you can isolate the problem to either Anaconda's python implementation or the VPython module itself.

PyDev does not highlight and autocomplete Numpy correctly

I am using a mac, I set up all the external libraries through PYTHONPATH, I tried setting it through Pydev interpreter as well.
It simply does not work. The odd thing is that pydev is highlighting the syntax as error, but when I run the code, it works perfectly. I am out of ideas of what the problem might be. I used to program in java with eclipse, and once you set up the external libraries all the highlighting and autocompletion is working. With pydev I have no idea what is wrong.
Here is the image of the wrong highlighting:
There's a similar problem with importing wxPython with PyDev Aptana Studio 3. Based on the research I did then, PyDev has a hard time validating new imports when a module has recently been downloaded. This means that there is just a bug in PyDev, so it would be a good idea to report it.
As for the solution, from what I've found a useful link with a ton of answers that should fix your problem. There's some detailed instructions but the fix that I found was towards the bottom someone said to try wx = wx after importing wx. This worked for me, but may not work for you so here is the link if you need a better answer:
Undefined variable from import when using wxPython in pydev

Categories