Skip to content

'Go to reference' does not traverse through relative imports #1224

@idchlife

Description

@idchlife

Environment data

  • VS Code version: 1.21.p
  • Extension version (available under the Extensions sidebar): 2018.2.1
  • OS and version: macOS 10.13.3
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.4
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): pipenv with proper python path in vscode
  • Relevant/affected Python packages and their versions: flask_restplus

Actual behavior

Going to definition for Namespace from flask_restplus goes to __init__.py instead of file namespace.py.
Also vscode shows error "instance of Namespace has no member ..." etc, since vscode-python cannot learn that

from .namespace import ...

is

from namespace import ...

Expected behavior

No errors, going to definition is fine

Steps to reproduce:

  1. Install pipenv, config vscode to work with python version
  2. Install flask_restplus, import Namespace from library, try to go inside and go to definition of Namespace in init.py file
  3. See vscode-python does not recognize "from .namespace import" and does not lead anywhere
  4. Remove dot and repeat
  5. See everything is working fine now, but source has been modified, so it's not a solution

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

XXX

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions