1
0
forked from VimPlug/jedi

completion on empty import problem

This commit is contained in:
David Halter
2013-05-19 21:12:37 +04:30
parent 384334ae06
commit a9bf06987a
2 changed files with 3 additions and 1 deletions

View File

@@ -162,9 +162,9 @@ class ImportPath(pr.Base):
# If you edit e.g. gunicorn, there will be imports like this: # If you edit e.g. gunicorn, there will be imports like this:
# `from gunicorn import something`. But gunicorn is not in the # `from gunicorn import something`. But gunicorn is not in the
# sys.path. Therefore look if gunicorn is a parent directory, #56. # sys.path. Therefore look if gunicorn is a parent directory, #56.
parts = self.file_path.split(os.path.sep)
in_path = [] in_path = []
if self.import_path: if self.import_path:
parts = self.file_path.split(os.path.sep)
for i, p in enumerate(parts): for i, p in enumerate(parts):
if p == self.import_path[0]: if p == self.import_path[0]:
new = os.path.sep.join(parts[:i]) new = os.path.sep.join(parts[:i])

View File

@@ -324,6 +324,8 @@ class TestRegression(TestBase):
# unrelated to #44 # unrelated to #44
defs = self.goto_assignments("import") defs = self.goto_assignments("import")
assert len(defs) == 0 assert len(defs) == 0
completions = self.completions("import", (1,1))
assert len(completions) == 0
def test_goto_following_on_imports(self): def test_goto_following_on_imports(self):
s = "import multiprocessing.dummy; multiprocessing.dummy" s = "import multiprocessing.dummy; multiprocessing.dummy"