mirror of
https://github.com/davidhalter/jedi-vim.git
synced 2025-12-07 19:24:36 +08:00
jedi#setup_python_imports: better SyntaxError handling
Uses `repr` for SyntaxErrors. Related: https://github.com/neovim/python-client/pull/221
This commit is contained in:
committed by
Dave Halter
parent
84a5299c8f
commit
745dc8a559
@@ -112,7 +112,11 @@ function! jedi#setup_python_imports(py_version) abort
|
|||||||
\ 'try:',
|
\ 'try:',
|
||||||
\ ' import jedi_vim',
|
\ ' import jedi_vim',
|
||||||
\ 'except Exception as exc:',
|
\ 'except Exception as exc:',
|
||||||
\ ' vim.command(''let s:init_outcome = "could not import jedi_vim: {0}: {1}"''.format(exc.__class__.__name__, exc))',
|
\ ' if isinstance(exc, SyntaxError):',
|
||||||
|
\ ' exc_msg = repr(exc)',
|
||||||
|
\ ' else:',
|
||||||
|
\ ' exc_msg = "%s: %s" % (exc.__class__.__name__, exc)',
|
||||||
|
\ ' vim.command(''let s:init_outcome = "could not import jedi_vim: {0}"''.format(exc_msg))',
|
||||||
\ 'else:',
|
\ 'else:',
|
||||||
\ ' vim.command(''let s:init_outcome = 1'')']
|
\ ' vim.command(''let s:init_outcome = 1'')']
|
||||||
try
|
try
|
||||||
|
|||||||
Reference in New Issue
Block a user