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>
diff --git a/internal/lsp/completion.go b/internal/lsp/completion.go
index 6304828..6df9778 100644
--- a/internal/lsp/completion.go
+++ b/internal/lsp/completion.go
@@ -32,8 +32,9 @@
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 3700c0b..8178f04 100644
--- a/internal/lsp/source/completion.go
+++ b/internal/lsp/source/completion.go
@@ -304,8 +304,9 @@
}
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 f3465f2..7cb4426 100644
--- a/internal/lsp/source/completion_format.go
+++ b/internal/lsp/source/completion_format.go
@@ -137,6 +137,9 @@
goto Return
}
item.Documentation = hover.Synopsis
+ if c.opts.WantFullDocumentation {
+ item.Documentation = hover.FullDocumentation
+ }
}
Return:
return item, nil