Omnicompletion for Python seems to fail when there is an import from out instead of the usual one. For example, if I have these two files:
Test.py:
class Test:
def method(self):
pass
main.py:
from Test import Test
class Test2:
def __init__(self):
self.x = Test()
If I try to activate omnicompletion for self.x ... it says: "Template not found." However, if I changed the import statement to:
import Test
and self.x declaration:
self.x = Test.Test()
then I can use omnicompletion as expected (for example, it offers a "method").
I am using Vim 7.2.245 and the default plugin to complete Python code (pythoncomplete). Should I set some variable? Or is this behavior expected?
Update
Based on Jared's answer, I accidentally found out:
Omnicompletion does not work on this:
from StringIO import StringIO
class Test:
def __init__(self):
self.x = StringIO()
self.x.<C-x><C-o>
s = Test()
But working on this:
from StringIO import StringIO
class Test:
def __init__(self):
self.x = StringIO()
self.x.<C-x><C-o>
s = Test()
s.x = StringIO()
x (, , __init__).
, , , .
main.py :
from Test import Test
class Test2:
def __init__(self):
self.x = Test()
self.x.<C-x><C-o>
y = Test()
y.<C-x><C-o>
omnicompletion , .
, yep, :)