mirror of https://github.com/dense-analysis/ale
Fix 4141 - Stop press enter prompt on long diagnostic messages (#4144)
* Fix 4141 - Stop press enter prompt on long diagnostic messages * Fix 4139 - Check for array before join truncated_echo
This commit is contained in:
parent
cae550f07b
commit
c984daa0ec
|
@ -11,9 +11,9 @@ let g:ale_echo_msg_format = get(g:, 'ale_echo_msg_format', '%code: %%s')
|
||||||
let s:cursor_timer = -1
|
let s:cursor_timer = -1
|
||||||
|
|
||||||
" A wrapper for echon so we can test messages we echo in Vader tests.
|
" A wrapper for echon so we can test messages we echo in Vader tests.
|
||||||
function! ale#cursor#Echon(message) abort
|
function! ale#cursor#Echom(message) abort
|
||||||
" no-custom-checks
|
" no-custom-checks
|
||||||
echon a:message
|
exec "norm! :echom a:message\n"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale#cursor#TruncatedEcho(original_message) abort
|
function! ale#cursor#TruncatedEcho(original_message) abort
|
||||||
|
@ -36,14 +36,7 @@ function! ale#cursor#TruncatedEcho(original_message) abort
|
||||||
silent! setlocal shortmess+=T
|
silent! setlocal shortmess+=T
|
||||||
|
|
||||||
try
|
try
|
||||||
" echon will not display the message if it exceeds the width of
|
call ale#cursor#Echom(l:message)
|
||||||
" the window
|
|
||||||
if &columns < strdisplaywidth(l:message)
|
|
||||||
" Truncate message longer than window width with trailing '...'
|
|
||||||
let l:message = l:message[:&columns - 5] . '...'
|
|
||||||
endif
|
|
||||||
|
|
||||||
call ale#cursor#Echon(l:message)
|
|
||||||
catch /^Vim\%((\a\+)\)\=:E523/
|
catch /^Vim\%((\a\+)\)\=:E523/
|
||||||
" Fallback into manual truncate (#1987)
|
" Fallback into manual truncate (#1987)
|
||||||
let l:winwidth = winwidth(0)
|
let l:winwidth = winwidth(0)
|
||||||
|
|
|
@ -231,7 +231,11 @@ function! ale#hover#HandleLSPResponse(conn_id, response) abort
|
||||||
\&& (l:set_balloons is 1 || l:set_balloons is# 'hover')
|
\&& (l:set_balloons is 1 || l:set_balloons is# 'hover')
|
||||||
call balloon_show(join(l:lines, "\n"))
|
call balloon_show(join(l:lines, "\n"))
|
||||||
elseif get(l:options, 'truncated_echo', 0)
|
elseif get(l:options, 'truncated_echo', 0)
|
||||||
call ale#cursor#TruncatedEcho(join(l:lines[0], '\n'))
|
if type(l:lines[0]) is# v:t_list
|
||||||
|
call ale#cursor#TruncatedEcho(join(l:lines[0], '\n'))
|
||||||
|
else
|
||||||
|
call ale#cursor#TruncatedEcho(l:lines[0])
|
||||||
|
endif
|
||||||
elseif g:ale_hover_to_floating_preview || g:ale_floating_preview
|
elseif g:ale_hover_to_floating_preview || g:ale_floating_preview
|
||||||
call ale#floating_preview#Show(l:lines, {
|
call ale#floating_preview#Show(l:lines, {
|
||||||
\ 'filetype': 'ale-preview.message',
|
\ 'filetype': 'ale-preview.message',
|
||||||
|
|
|
@ -89,7 +89,7 @@ Before:
|
||||||
|
|
||||||
let g:last_message = ''
|
let g:last_message = ''
|
||||||
|
|
||||||
function! ale#cursor#Echon(message) abort
|
function! ale#cursor#Echom(message) abort
|
||||||
let g:last_message = a:message
|
let g:last_message = a:message
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue