python-language-server icon indicating copy to clipboard operation
python-language-server copied to clipboard

Python Intellisense failing for certain import statements

Open smagrath opened this issue 5 years ago • 0 comments

Environment data

  • VS Code version: 1.45.1
  • Extension version (available under the Extensions sidebar): 2020.5.80290
  • OS and version: Linux x64 5.4.0-29-generic
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.2 64 bit
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: networkx
  • Relevant/affected Python-related VS Code extensions and their versions: XXX
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info microsoft/vscode-python#3977): True
  • Value of the python.languageServer setting: Microsoft

Expected behaviour

Intellisense is expected to work when you import a module and use a shortened reference name For example, "import networkx as nx" I expect to be able to use "nx" and get correct intellisense behaviour.

Actual behaviour

Intellisense does NOT work when using the shortened module name reference. It does work when using the full module name eg "import networkx" and then "networkx." intellisense works as expected.

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Create a python file - say main.py
import networkx as nx
G = nx.Graph()
  1. All intellisense involving nx fails.
  2. However, simply using "import networkx" works - though you must use the very long module name
import networkx
G = networkx.Graph()

Does this issue occur when all extensions are disabled?: Yes

Logs

Not provided or needed

smagrath avatar May 20 '20 00:05 smagrath