Each Answer to this Q is separated by one/two green lines.
I’ve been using Visual Studio Community for a few months now, but the sluggishness and project-based interface is not to my liking and having seen that Visual Studio Code has a python extension, I decided to try Code again.
There are two problems with Code, that if possible to solve I’d promote it to my main editor.
First is intellisense. I have downloaded the python extension for Code, which promises intellisense. However, outside of the core python packages (like “math”) intellisense is not working. I’ve tried to set up the extra environment variable as described in the link, but that didn’t work either.
After this I re-crated an anaconda environment, just in case. Each anaconda environment basically operates as a separate python install and has the modules like “scipy” etc under Lib/site-packages to properly be able to reference them.
As you might guess, intellisense for VS Code still isn’t working. Maybe there’s a way to refresh its database like for VS Community but I couldn’t find it.
My second issue is lack of auto-indentation for python, which wasn’t the case when I first installed Code some 6 months ago. The issue was present 2-3 months ago, I hoped it was fixed by now but apparently not. There’s nothing new written about it on the Internets either.
How do I get VS Code to work well for me with python?
I have installed python 3.6.5 and Django 2.0.4 on windows 10 OS.
In vs code open command palette (Ctrl+Shift+p).
There select Python:Select Interpreter
Close your vs code and then try. If it still does not work. Try again by changing to:-
Python:Build Workspace symbols and re-open the vs code. That’s all i did and got intelligence enabled.
Old question that worth another working answer:
settings.json, set the value of
false (see some more details here).
P.S. You can also try and move back to Jedi (just remove
python.jediEnabled or set it to
true), and in my case, Intellisense keeps working, though much slower.
This is how I got Python intellisense to start working in VS Code:
- open up the Terminal (View menu => Terminal)
conda init powershell
- restart VS Code
After that, Python intellisense started working correctly for me.
On your VS code use the command ctr + shift + P then search for Python: Select Lint and choose your preferred linting tool. This worked for me.
Bro, instead of
import matplotlib.pyplot as plt
from matplotlib import pyplot as plt
I’ve tried it in VSCode and it works for the second statement but not the first statement.
This is how I got it to work:
Open command palette (Ctrl + Shift + P).
Type “Python: Build Workspace Symbols” and hit Enter.