1
0
forked from VimPlug/jedi

fix an issue with invalid syntax

This commit is contained in:
Dave Halter
2014-01-26 20:22:51 +01:00
parent ba6a65c477
commit 8193f0c2b6

View File

@@ -213,6 +213,11 @@ class UserContextParser(object):
if not user_stmt:
# for statements like `from x import ` (cursor not in statement)
# or `abs( ` where the cursor is out in the whitespace.
if self._user_context.get_path_under_cursor():
# We really should have a user_stmt, but the parser couldn't
# process it - probably a Syntax Error.
debug.warning('Something is probably wrong with the syntax under the cursor.')
return None
pos = next(self._user_context.get_context(yield_positions=True))
user_stmt = self.module().get_statement_for_position(pos, include_imports=True)
return user_stmt