mirror of https://github.com/dense-analysis/ale
Replace line breaks in virtual text with whitespace (#3949)
Before this patch multiline warnings would appear in a single line with '^@' as separator. Now we use whitespace as separator to improve the appearance. Also strip trailing whitespace, newlines, etc... Fixes #3939
This commit is contained in:
parent
95ba7898b4
commit
da331acc9e
|
@ -64,15 +64,16 @@ function! ale#virtualtext#ShowMessage(message, hl_group) abort
|
||||||
let l:line = line('.')
|
let l:line = line('.')
|
||||||
let l:buffer = bufnr('')
|
let l:buffer = bufnr('')
|
||||||
let l:prefix = get(g:, 'ale_virtualtext_prefix', '> ')
|
let l:prefix = get(g:, 'ale_virtualtext_prefix', '> ')
|
||||||
|
let l:msg = l:prefix.trim(substitute(a:message, '\n', ' ', 'g'))
|
||||||
|
|
||||||
if has('nvim')
|
if has('nvim')
|
||||||
call nvim_buf_set_virtual_text(l:buffer, s:ns_id, l:line-1, [[l:prefix.a:message, a:hl_group]], {})
|
call nvim_buf_set_virtual_text(l:buffer, s:ns_id, l:line-1, [[l:msg, a:hl_group]], {})
|
||||||
else
|
else
|
||||||
let l:left_pad = col('$')
|
let l:left_pad = col('$')
|
||||||
call prop_add(l:line, l:left_pad, {
|
call prop_add(l:line, l:left_pad, {
|
||||||
\ 'type': 'ale',
|
\ 'type': 'ale',
|
||||||
\})
|
\})
|
||||||
let s:last_popup = popup_create(l:prefix.a:message, {
|
let s:last_popup = popup_create(l:msg, {
|
||||||
\ 'line': -1,
|
\ 'line': -1,
|
||||||
\ 'padding': [0, 0, 0, 1],
|
\ 'padding': [0, 0, 0, 1],
|
||||||
\ 'mask': [[1, 1, 1, 1]],
|
\ 'mask': [[1, 1, 1, 1]],
|
||||||
|
|
Loading…
Reference in New Issue