Skip to content

Commit

Permalink
lsp: show info of types without godoc correctly
Browse files Browse the repository at this point in the history
Do not strip the first line of hover content when the first line is not
godoc.

Fixes #2372
  • Loading branch information
bhcleek committed Jun 28, 2019
1 parent d1c8ffb commit b3ec7f2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions autoload/go/lsp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,17 @@ function! s:infoFromHoverContent(content) abort
let l:content = a:content[0]

" strip godoc summary
let l:content = substitute(l:content, '^[^\n]\+\n', '', '')
" Hover content with godoc summary will have the godoc summary in the first
" line, and the second line will not have leading whitespace. When there is
" leading whitespace on the second line, then the hover content is for a
" struct or interface without godoc.
let l:lines = split(l:content, '\n')
if len(l:lines) > 1 && (l:lines[1] !~# '^\s')
let l:content = substitute(l:content, '^[^\n]\+\n', '', '')
endif

" strip off the method set and fields of structs and interfaces.
if l:content =~# '^type [^ ]\+ \(struct\|interface\)'
if l:content =~# '^\(type \)\?[^ ]\+ \(struct\|interface\)'
let l:content = substitute(l:content, '{.*', '', '')
endif

Expand Down

0 comments on commit b3ec7f2

Please sign in to comment.