1825

· 👁 20 views

#vim
#java
#hover #balloon with type definition ftplugin/java.vim, with #coc

highlight CocTypePopup ctermfg=White ctermbg=22 guifg=#ffffff guibg=#005f00

function! CocTypeBalloonExpr() abort

  try
    let l:docs = CocAction('getHover', {
      \ 'bufnr': v:beval_bufnr,
      \ 'line': v:beval_lnum,
      \ 'col': v:beval_col
      \ })
  catch
    return ''
  endtry

  for l:line in split(join(l:docs, "\n"), "\n")
    let l:line = trim(l:line)
    call popup_beval(l:line, {
      \ 'maxwidth': 200,
      \ 'padding': [0, 1, 0, 1],
      \ 'border': [0, 0, 0, 0],
      \ 'highlight': 'CocTypePopup',
      \ 'wrap': 1
      \ })
    return ''
  endfor

  return ''
endfunction

if !has('nvim')
  setl balloonevalterm
  setl balloonexpr=CocTypeBalloonExpr()
endif