diff --git a/internal/lsp/completion.go b/internal/lsp/completion.go index 6304828c67..6df9778ca7 100644 --- a/internal/lsp/completion.go +++ b/internal/lsp/completion.go @@ -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)) diff --git a/internal/lsp/source/completion.go b/internal/lsp/source/completion.go index 3700c0bad2..8178f0498d 100644 --- a/internal/lsp/source/completion.go +++ b/internal/lsp/source/completion.go @@ -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 diff --git a/internal/lsp/source/completion_format.go b/internal/lsp/source/completion_format.go index f3465f251c..7cb4426c8d 100644 --- a/internal/lsp/source/completion_format.go +++ b/internal/lsp/source/completion_format.go @@ -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