Skip to content

Commit

Permalink
Merge pull request #2373 from bhcleek/lsp/hover-has-no-godoc
Browse files Browse the repository at this point in the history
lsp: show info of types without godoc correctly
  • Loading branch information
bhcleek authored Jun 28, 2019
2 parents d1c8ffb + b3ec7f2 commit 1c5b8df
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 1c5b8df

Please sign in to comment.