Skip to content

Commit 070a957

Browse files
authored
Merge pull request #2311 from bhcleek/lsp/info
lsp: strip godoc summary in info handler
2 parents 78ef2ca + c05c426 commit 070a957

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

autoload/go/lsp.vim

+6-2
Original file line numberDiff line numberDiff line change
@@ -542,13 +542,13 @@ function! go#lsp#Info(showstatus)
542542
let l:state = s:newHandlerState('')
543543
endif
544544

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

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

@@ -572,6 +572,10 @@ endfunction
572572

573573
function! s:info(content) abort dict
574574
let l:content = a:content[0]
575+
576+
" strip godoc summary
577+
let l:content = substitute(l:content, '^[^\n]\+\n', '', '')
578+
575579
" strip off the method set and fields of structs and interfaces.
576580
if l:content =~# '^type [^ ]\+ \(struct\|interface\)'
577581
let l:content = substitute(l:content, '{.*', '', '')

0 commit comments

Comments
 (0)