Fix displaying of error information with shortmess+=F

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: https://github.com/neovim/neovim/issues/8675
This commit is contained in:
Daniel Hahler
2018-08-01 13:37:10 +02:00
committed by Dave Halter
parent 1126ffde9b
commit 399c57ff72

View File

@@ -96,6 +96,30 @@ function! jedi#reinit_python() abort
endfunction 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 let s:_init_python = -1
function! jedi#init_python() abort function! jedi#init_python() abort
if s:_init_python == -1 if s:_init_python == -1
@@ -108,20 +132,7 @@ function! jedi#init_python() abort
" unexpected Python exceptions the traceback will be shown " unexpected Python exceptions the traceback will be shown
" (e.g. with NameError in jedi#setup_python_imports's code). " (e.g. with NameError in jedi#setup_python_imports's code).
if !exists('g:jedi#squelch_py_warning') if !exists('g:jedi#squelch_py_warning')
let error_lines = split(v:exception, '\n') unsilent call s:display_exception()
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
endif endif
endtry endtry
endif endif
@@ -189,8 +200,8 @@ function! jedi#debug_info() abort
if !s:pythonjedi_called if !s:pythonjedi_called
echohl WarningMsg echohl WarningMsg
echom 'PythonJedi failed to run, likely a Python config issue.' echom 'PythonJedi failed to run, likely a Python config issue.'
if exists(':CheckHealth') == 2 if exists(':checkhealth') == 2
echom 'Try :CheckHealth for more information.' echom 'Try :checkhealth for more information.'
endif endif
echohl None echohl None
else else