This project has moved. For the latest updates, please go here.

Support Quick Tips and Go to Definition in from..import


Consider a project consisting of two modules as follows:
def foo(x):
    return x*2
from module1 import foo
When typing "from" in the second file, you get completion for modules and packages, and module1 is in that list. However, after fully typing the from..import statement, hovering over module1 in it will show "<unknown type>" in the tool tip, and Go to Definition on it will not work. On the other hand, if "import module1" is added on the line before "from ...", then both quick tip and go to definition start working.

The problem here is that we're treating the module name in "from" as a regular expression, and since "module1" is not itself imported, it is an unbound identifier when interpreted that way. We should instead special-case quick tips & go to def for from..import so that they always properly interpret the dotted path as module/package names.