Skip to content

Commit

Permalink
Merge pull request #2311 from bhcleek/lsp/info
Browse files Browse the repository at this point in the history
lsp: strip godoc summary in info handler
  • Loading branch information
bhcleek authored May 26, 2019
2 parents 78ef2ca + c05c426 commit 070a957
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions autoload/go/lsp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -542,13 +542,13 @@ function! go#lsp#Info(showstatus)
let l:state = s:newHandlerState('')
endif

let l:state.handleResult = funcref('s:infoDefinitionHandler', [function('s:info', []), a:showstatus], l:state)
let l:state.handleResult = funcref('s:infoDefinitionHandler', [a:showstatus], l:state)
let l:state.error = funcref('s:noop')
let l:msg = go#lsp#message#Definition(l:fname, l:line, l:col)
return l:lsp.sendMessage(l:msg, l:state)
endfunction

function! s:infoDefinitionHandler(next, showstatus, msg) abort dict
function! s:infoDefinitionHandler(showstatus, msg) abort dict
" gopls returns a []Location; just take the first one.
let l:msg = a:msg[0]

Expand All @@ -572,6 +572,10 @@ endfunction

function! s:info(content) abort dict
let l:content = a:content[0]

" strip godoc summary
let l:content = substitute(l:content, '^[^\n]\+\n', '', '')

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

0 comments on commit 070a957

Please sign in to comment.