Skip to content

Commit

Permalink
Fix displaying of error information with shortmess+=F
Browse files Browse the repository at this point in the history
When being initialized via ftplugin `set shortmess+=F` (default in
Neovim by now) causes the additional information (the full traceback) to
be silenced.

This patch uses `:unsilent` to always display it.

Ref: neovim/neovim#8675
  • Loading branch information
blueyed authored and davidhalter committed Aug 1, 2018
1 parent 1126ffd commit 399c57f
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions autoload/jedi.vim
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,30 @@ function! jedi#reinit_python() abort
endfunction


" This is meant to be called with `:unsilent` (for &shortmess+=F).
function! s:display_exception() abort
let error_lines = split(v:exception, '\n')
let msg = 'Error: jedi-vim failed to initialize Python: '
\ .error_lines[0].' (in '.v:throwpoint.')'
if len(error_lines) > 1
echohl ErrorMsg
echom 'jedi-vim error: '.error_lines[0]
for line in error_lines[1:]
echom line
endfor
echohl None
let help_cmd = ':JediDebugInfo'
if exists(':checkhealth') == 2
let help_cmd .= ' / :checkhealth'
endif
let msg .= printf('. See :messages and/or %s for more information.',
\ help_cmd)
endif
redraw " Redraw to only have the main message by default.
echoerr msg
endfunction


let s:_init_python = -1
function! jedi#init_python() abort
if s:_init_python == -1
Expand All @@ -108,20 +132,7 @@ function! jedi#init_python() abort
" unexpected Python exceptions the traceback will be shown
" (e.g. with NameError in jedi#setup_python_imports's code).
if !exists('g:jedi#squelch_py_warning')
let error_lines = split(v:exception, '\n')
let msg = 'Error: jedi-vim failed to initialize Python: '
\ .error_lines[0].' (in '.v:throwpoint.')'
if len(error_lines) > 1
echohl ErrorMsg
echom 'jedi-vim error: '.error_lines[0]
for line in error_lines[1:]
echom line
endfor
echohl None
let msg .= '. See :messages for more information.'
endif
redraw " Redraw to only have the main message by default.
echoerr msg
unsilent call s:display_exception()
endif
endtry
endif
Expand Down Expand Up @@ -189,8 +200,8 @@ function! jedi#debug_info() abort
if !s:pythonjedi_called
echohl WarningMsg
echom 'PythonJedi failed to run, likely a Python config issue.'
if exists(':CheckHealth') == 2
echom 'Try :CheckHealth for more information.'
if exists(':checkhealth') == 2
echom 'Try :checkhealth for more information.'
endif
echohl None
else
Expand Down

0 comments on commit 399c57f

Please sign in to comment.