Intellisense doesn't respect absolute imports (Jedi)
See original GitHub issueEnvironment data
- VS Code version: 1.25.1
- Extension version (available under the Extensions sidebar): 2018.7.0
- OS and version: MacOS 10.13.5
- Python version (& distribution if applicable, e.g. Anaconda): all
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): venv, virtualenv, conda, or none
- Relevant/affected Python packages and their versions: any
Actual behavior
Given a local package or module that has the same name as an installed package, for example:
my_project
| my_package
| __init__.py
| celery.py
Contents of my_project/my_package/celery.py
:
from __future__ import absolute_import # for compatibility with python 2
import celery
celery.Celery('tasks')
Contents of my_project/my_package/__init__.py
:
Intellisense treats import celery
line as importing local module (the current file) into its self instead of the top level package.
Expected behavior
Intellisense should import the global package (celery
in this example), not the local module (my_project.celery
)
Steps to reproduce:
- create a package or module with the same local name as another package or module in python’s path.
- import the package or module
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:19 (10 by maintainers)
Top Results From Across the Web
VSCode Intellisense doesn't resolve imports with absolute paths
I'm maintaining an electron app using Typescript. I'm trying to implement absolute paths for imports in my project.
Read more >Modern IDEs are magic. Why are so many coders still using ...
Setting it up involves picking your board from a menu, and there's a nice dialog for importing libraries too. The whole compile-and-deploy thing ......
Read more >Absolute imports and intellisense with create-react-app (no ...
By default create-react-app does not allow absolute imports that means you always need to check the location of the file.
Read more >Valloric/YouCompleteMe - Gitter
I only get first/second level autocompletion like tf.data.Dataset. Also GetDoc doesn't work. There was some problem with tensorflow lazy imports which jedi ......
Read more >IPython Documentation - Read the Docs
Requiring widgets/js/widget doesn't import the WidgetManager class, instead it imports a dictionary that exposes the classes within that module:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@moi90 best option would be to use the Microsoft language server.
I’m going to re-open this issue to be triaged so we can see if there’s anything we can do or if it’s entirely up to Jedi to fix.
FYI, with that last bit of info I was able to reproduce the problem under Python 3.7 on linux. Intellisense is showing completions for the local module rather than the installed package.