Visual Studio Code: Intellisense not working
Solution 1:
This can be caused by many reasons, some of them are as follows.
-
Python executable path in vscode is incorrect
- Solution: Configure the path to the python executable in
settings.json
. Remember to restart vscode after.
- Solution: Configure the path to the python executable in
-
The module is located in a non-standard location
-
Solution: Configure
settings.json
to include this location for autocompletion to work. An example (for Linux) used to add a custom module for the workspace:{ "python.pythonPath": "/usr/bin/python", "python.autoComplete.extraPaths": [ "${workspaceFolder}/customModule" ] }
-
-
vscode was not launched from the active virtual environment
- Solution: The path to the modules is set when a virtual environment is activated. Launch vscode from a terminal with the correct virtual environment activated
Solution 2:
Installing Pylance
addon caused Vscode Intellisense to stop.
On disabling Pylance and enabling the Default Microsoft Python extension
along with Visual Studio IntelliCode(Microsoft)
and reverting to the Jedi server
(prompted by Vscode) ,restarted intellisense detection.
Solution 3:
If you've tried everything but still if it doesn't work, in my case installing the extension Visual Studio IntelliCode with the Python extension worked.
Solution 4:
First of all if you've installed virtualenv on your project run vscode from there. Then in your vscode settings, i mean settings.json, you can follow my configuration or trace in which one you have a problem. Most of time this problem stem from putting incorrect path in pythonPath setting
{
"python.pythonPath": "${workspaceFolder}/env/bin/python3",
"editor.formatOnSave": true,
"python.linting.pep8Enabled": true,
"python.linting.pylintPath": "pylint",
"python.linting.pylintArgs": ["--load-plugins", "pylint_django"],
"python.linting.pylintEnabled": true,
"python.linting.pep8Args": ["--ignore=E501"],
"files.exclude": {
"**/*.pyc": true
}
}
Update:
If you want to have a well-configuration of Vscode That i personally use for developing my Django and React web-applications you can glance this.
Solution 5:
i change change the :jedi true 2 false, or flase 2 true, when reload the VSCode, that's ok.
my setting:
{
"editor.fontSize": 16,
"explorer.confirmDragAndDrop": false,
"extensions.autoUpdate": false,
"workbench.colorTheme": "Default Dark+",
"editor.fontFamily": "Consolas, Dengxian",
"workbench.sideBar.location": "left",
"workbench.startupEditor": "newUntitledFile",
"workbench.iconTheme": "material-icon-theme",
"python.pythonPath": "d:\\Source\\Django\\Scripts\\python.exe",
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"git.ignoreLimitWarning": true,
"python.jediEnabled": true,
"python.autoComplete.extraPaths": [
"d:\\Source\\Django\\",
],
"python.autoComplete.addBrackets": true
}