#1051 Go to definition problem

Editor (491)

When I am in certain files, for example, External Library files, I am getting this behavior where the Go To Definition command jumps me to the import statement at the top of the file instead of opening the file with the real definition.

For example, I'm in an external library, (jumped here using Go To Definition), and from here, I again want to jump, so I put the cursor on the return statement on the Something token and hit "Go To Definition"....

from package.forme.mod import Something
. . .
def scoped_session(arg):
. . .
return Something(arg)

... which jumps me to the "from package.forme.mod import Something" statement at the top of the file. I have the paths and sub-paths defined in External Libraries for the project.

I expect it to instead open the actual definition in the given package/file instead of jumping to the import statement.

Windows XP
Eclipse (Flex Builder 3) version 3.3, but also tried eclipse 3.5 (no flex builder) with same results.
PyDev 1.5.3
IMPORTANT: My project is mounted on a linux machine. I am using the windows python 2.6 interpreter, but when I actually run my code in linux, it is not the same interpreter (still 2.6). I would guess that shouldn't affect the Go To Definition, but since it might, I wanted to mention it so as to not cause a wild goose chase.


  • Cykooz

    Cykooz - 2011-10-06

    I have exactly the same problem. It complicates the code review and troubleshooting.
    Ubuntu 11.04
    Python 2.7.1
    Eclipse 3.7.1
    PyDev 2.2.2

  • Cykooz

    Cykooz - 2012-02-02

    Please answer at least something on this issue!

    You can not reproduce it?
    You do not consider it is important?
    You do not know how to fix it?

    Ubuntu 11.10
    Python 2.7.2
    Eclipse 3.7.1
    PyDev 2.2.4

  • Cykooz

    Cykooz - 2012-02-02

    Small fix - I am use PyDev 2.4.0

  • Fabio Zadrozny

    Fabio Zadrozny - 2012-02-09
    • status: open --> pending
  • Fabio Zadrozny

    Fabio Zadrozny - 2012-02-09

    Hi, just saw this issue because of a stack overflow comment... not sure why, but sourceforge did not e-mail me anything in this bug (so, I'm sorry for the late response).

    Now, on to the problem, in that structure, is your file accessed through a symlink?

  • Cykooz

    Cykooz - 2012-02-09

    > Now, on to the problem, in that structure, is your file accessed through a symlink?


    To reproduce the problem, follow these steps:
    1. Create the empty workspace and cofigure the Python iterpreter.
    2. Switch to the PyDev perspective.
    3. Extract all from arhive ( http://dl.dropbox.com/u/6131565/projects.zip ) into workspace directory.
    4. Create the new PyDev Project with name "Project1".
    5. In the project properies add one External Library by add the source folder "/<worspace-folder>/Project2"
    6. In the Project1 open the file "main.py" and jump to definition of "test_func" function (it is defined in the Project2)
    7. Now try to go to the definition of "get_result" function.

    In my case, after last step, I move to the line "from project2.main import get_result", instead of that would go to the definition of the function "get_result".
    If you add a Project2 into a workspace, then everything will work correctly.

    PS: Sorry for my English

  • Fabio Zadrozny

    Fabio Zadrozny - 2012-04-12
    • status: pending --> closed-fixed
  • Fabio Zadrozny

    Fabio Zadrozny - 2012-04-12

    Fixed for 2.6.0

    A new nightly build should be issued later today, so, please grab it tomorrow and let me know if the fix worked for you (see: http://pydev.org/download.html for details on getting the nightly build).

    [development 3fe9ffe] When searching for external files, also take a look at the configured projects, as it may be that the file should actually be found in an external source folder.

  • Andrea Censi

    Andrea Censi - 2013-04-07

    I still see this behavior. I am now on Pydev 2.7.4, and I have observed it since 2.4 at least.

    Does the OS make a difference? I'm on OS X 10.8.2.