From 68cbf4169ff06ced24eea94246078a50c0eb3aad Mon Sep 17 00:00:00 2001 From: pjw Date: Tue, 7 Dec 2021 15:39:00 -0500 Subject: [PATCH] internal/lsp/template: add missed hover cases Templates were reporting 'oops' when hovering over a string. Fixes: golang/go#50031 Change-Id: I9e256b1f7d193bf090590c1ec71e85fc8493d7f7 Reviewed-on: https://go-review.googlesource.com/c/tools/+/369956 Run-TryBot: Peter Weinberger gopls-CI: kokoro TryBot-Result: Gopher Robot Trust: Peter Weinberger Reviewed-by: Hyang-Ah Hana Kim --- internal/lsp/template/implementations.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/lsp/template/implementations.go b/internal/lsp/template/implementations.go index 66dcc4baaa..2db0341147 100644 --- a/internal/lsp/template/implementations.go +++ b/internal/lsp/template/implementations.go @@ -118,6 +118,12 @@ func Hover(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle, ans.Contents.Value = fmt.Sprintf("template %s\n(add definition)", sym.name) case protocol.Namespace: ans.Contents.Value = fmt.Sprintf("template %s defined", sym.name) + case protocol.Number: + ans.Contents.Value = "number" + case protocol.String: + ans.Contents.Value = "string" + case protocol.Boolean: + ans.Contents.Value = "boolean" default: ans.Contents.Value = fmt.Sprintf("oops, sym=%#v", sym) }