internal/lsp: propagate hoverKind to completion documentation

Fixes golang/go#33653

Change-Id: Ia45e4f4b7377681619303a6d414d9b9de3143c01
Reviewed-on: https://go-review.googlesource.com/c/tools/+/190400
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Rebecca Stambler 2019-08-15 11:35:00 -04:00
parent 3100af0b0e
commit 2562441715
3 changed files with 9 additions and 4 deletions

View File

@ -32,8 +32,9 @@ func (s *Server) completion(ctx context.Context, params *protocol.CompletionPara
return nil, err
}
candidates, surrounding, err := source.Completion(ctx, view, f, rng.Start, source.CompletionOptions{
DeepComplete: s.useDeepCompletions,
WantDocumentaton: s.wantCompletionDocumentation,
DeepComplete: s.useDeepCompletions,
WantDocumentaton: s.wantCompletionDocumentation,
WantFullDocumentation: s.hoverKind == fullDocumentation,
})
if err != nil {
log.Print(ctx, "no completions found", tag.Of("At", rng), tag.Of("Failure", err))

View File

@ -304,8 +304,9 @@ type candidate struct {
}
type CompletionOptions struct {
DeepComplete bool
WantDocumentaton bool
DeepComplete bool
WantDocumentaton bool
WantFullDocumentation bool
}
// Completion returns a list of possible candidates for completion, given a

View File

@ -137,6 +137,9 @@ func (c *completer) item(cand candidate) (CompletionItem, error) {
goto Return
}
item.Documentation = hover.Synopsis
if c.opts.WantFullDocumentation {
item.Documentation = hover.FullDocumentation
}
}
Return:
return item, nil