Autocompletion problem

Alex Snast
2008-09-28
2013-03-15
  • Alex Snast
    Alex Snast
    2008-09-28

    Hello,

    I've been using Pydev for the past week and I've been having problems with the autocompletion feature.

    If i write the following code:

    from numpy import *

    a = array([[1,2,3],[4,5,6]])
    print a.dtype

    The array wasn't poping up when till i added numpy to the forced builtin's however when i type "a." i can see a small amount of magic functions (not all) and not the whole namespace(it's showing fine in IPython).

    Any fix on that?

    Regards, Alex

     
    • Alex Snast
      Alex Snast
      2008-09-28

      P.s.

      Forgot to mention. when i type "a = arr" and then hit Ctrl + Space it takes around 5 seconds to load.

      And everything from the pydev console works fine without adding the buildins (all the methods loads instantly + has all the features)

       
      • Fabio Zadrozny
        Fabio Zadrozny
        2008-09-29

        In the 1st time right? That happens because of the way that numpy is structured (too many wild imports), so, pydev has to statically analyze almost the whole numpy structure to give you that 1st completion (after that it should be cached and much faster).

        As for the difference on the console and actual code-completion, it's explained in the other post...

        Cheers,

        Fabio

         
    • Fabio Zadrozny
      Fabio Zadrozny
      2008-09-29

      That's currently because of the amount of information that pydev has to work with. It can only work with dir() calls in the shell and doesn't actually call or instance any other object -- if you added numpy to the forced builtins, otherwise it depends more on what's available from statically analyzing it, and even with many heuristics, sometimes the information is just not available without running it.

      So, what's happening is that it does a dir(numpy) and later a dir(numpy.array) -- which is very different from the amount of information that the shell has, where it can do a dir(numpy.array([[1,2,3],[4,5,6]])).

      So, not really fixable (there are plans to give users a way to give code-completion based on some pre-compiled information for those shortcomings, but there's still no date on when that'll be available).

      Cheers,

      Fabio