22 str = unicode # __IGNORE_WARNING__ |
22 str = unicode # __IGNORE_WARNING__ |
23 sys.path.insert(0, path) |
23 sys.path.insert(0, path) |
24 |
24 |
25 import rope.base.libutils |
25 import rope.base.libutils |
26 import rope.contrib.codeassist |
26 import rope.contrib.codeassist |
27 from rope.base.exceptions import BadIdentifierError |
27 from rope.base.exceptions import BadIdentifierError, ModuleSyntaxError |
28 |
28 |
29 from JsonClient import JsonClient |
29 from JsonClient import JsonClient |
30 |
30 |
31 |
31 |
32 class CodeAssistClient(JsonClient): |
32 class CodeAssistClient(JsonClient): |
358 fixer = fixsyntax.FixSyntax(project, sourceCode, resource, |
358 fixer = fixsyntax.FixSyntax(project, sourceCode, resource, |
359 maxfixes) |
359 maxfixes) |
360 pyname = fixer.pyname_at(offset) |
360 pyname = fixer.pyname_at(offset) |
361 except BadIdentifierError: |
361 except BadIdentifierError: |
362 pyname = None |
362 pyname = None |
|
363 except ModuleSyntaxError: |
|
364 pyname = None |
|
365 except IndexError: |
|
366 pyname = None |
363 if pyname is None: |
367 if pyname is None: |
364 return "<unknown>", "<unknown>" |
368 return "<unknown>", "<unknown>" |
365 |
369 |
366 pyobject = pyname.get_object() |
370 pyobject = pyname.get_object() |
367 if isinstance(pyobject, pyobjectsdef.PyPackage): |
371 if isinstance(pyobject, pyobjectsdef.PyPackage): |