Fix #3273 - Handle missing keys in hover information

This commit is contained in:
w0rp
2020-08-07 12:34:45 +01:00
parent 388049dbea
commit f741245f11
2 changed files with 9 additions and 1 deletions

View File

@@ -91,11 +91,12 @@ function! ale#hover#HandleLSPResponse(conn_id, response) abort
if type(l:result) is v:t_dict
" If the result is an object, then it's markup content.
let l:result = [l:result.value]
let l:result = has_key(l:result, 'value') ? [l:result.value] : []
endif
if type(l:result) is v:t_list
" Replace objects with text values.
call filter(l:result, '!(type(v:val) is v:t_dict && !has_key(v:val, ''value''))')
call map(l:result, 'type(v:val) is v:t_string ? v:val : v:val.value')
let l:str = join(l:result, "\n")
let l:str = substitute(l:str, '^\s*\(.\{-}\)\s*$', '\1', '')