mirror of
https://github.com/davidhalter/jedi-vim.git
synced 2025-12-06 10:54:22 +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:',
|
||||
\ ' import jedi_vim',
|
||||
\ '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:',
|
||||
\ ' vim.command(''let s:init_outcome = 1'')']
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user