Skip to content

Go to definition for Python project does not work with relative imports #274

Closed

Description

@imdadahad

Environment data

VS Code version: Version 1.18.1 (1.18.1)
Python Extension version: 0.8.0
Python Version: 3.6
OS and version: Mac High Sierra

Actual behavior

Assuming my current project structure:

-stopwatch_app
--test.py
--utils
---greeter.py

And contents of:

# test.py

from utils.greeter import print_greeting

def main():
    print_greeting()
# utils/greeter.py

def print_greeting():
   print('Hello')

In test.py, when I select go to definition for the print_greeting method in main (Figure 1), it automatically places the cursor right before the import definition (Figure 2).

Figure 1
image

Figure 2
image

Expected behavior

It should instead take me to the print_greeting() definition in the utils/greeter.py file.

Steps to reproduce:

  • Download the source
    stopwatch_app.zip
  • Open the source project in VSCode
  • Go to test.py, right click on print_greeting() defined in main and select Go To Definition

Logs

Output from Python output panel
N/A

Activity

  1. imdadahad commented on Dec 2, 2017

    @imdadahad
    Author

    Bump

  2. brettcannon commented on Dec 4, 2017

    @brettcannon
    Member

    Imdad Ahad (@imdadahad) there's no need to bump the issue as we've triaged it and are aware of your request. We just also have 57 other issues to verify along with 41 bugs awaiting fixes. 😟

  3. DonJayamanne commented on Jan 18, 2018

    @DonJayamanne

    Reported as an upstream issue davidhalter/jedi#1029

  4. pchomik commented on Mar 15, 2018

    @pchomik

    Any update regarding this issue?
    I downloaded latest version of jedi and configured vscode to use it. Problem still exists.

  5. DonJayamanne commented on Mar 15, 2018

    @DonJayamanne

    I downloaded latest version of jedi and configured vscode to use it. Problem still exists.

    Pawel Chomicki (@pchomik) Have you reported this upstream?

  6. pchomik commented on Mar 19, 2018

    @pchomik

    I haven't report it upstream.
    I don't know how to prepare small example for them to show issue. In my opinion example from vscode is not valid.

  7. brettcannon commented on Apr 19, 2018

    @brettcannon
    Member

    Should be fixed in the next release.

  8. JensMadsen commented on May 9, 2018

    @JensMadsen

    it is still not working. Works when starting vsc but stops working after a while

    Version 1.23.0
    Commit 7c7da59c2333a1306c41e6e7b68d7f0caa7b3d45
    Date 2018-05-03T15:23:19.356Z
    Shell 1.7.12
    Renderer 58.0.3029.110
    Node 7.9.0
    Architecture x64

  9. DonJayamanne commented on May 9, 2018

    @DonJayamanne

    Please could you check if there are any errors in the console window (go into Help->Toggle Developer Tools)

  10. locked as resolved and limited conversation to collaborators on Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-intellisenseLSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc.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