From cb5dc85ca1a7e5a7f2ece11dfedb3577274cbdf1 Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Wed, 17 Feb 2021 23:03:24 -0500 Subject: [PATCH] internal/lsp/cache: add a scheme for types error code links Links in the new LSP diagnostic CodeDescription for go/types errors are missing a scheme (unclear why they work in some clients). Fix this by delegating to the existing source.BuildLink helper (this also adds the utm_source query parameter for pkg.go.dev). Fixes golang/go#44360 Change-Id: Ife8969f32bb11840c0fdd31765b6051b3d997a93 Reviewed-on: https://go-review.googlesource.com/c/tools/+/293509 Trust: Rebecca Stambler Trust: Robert Findley Run-TryBot: Rebecca Stambler TryBot-Result: Go Bot Reviewed-by: Rebecca Stambler --- internal/lsp/cache/errors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/lsp/cache/errors.go b/internal/lsp/cache/errors.go index 9d109de15f..42fafae812 100644 --- a/internal/lsp/cache/errors.go +++ b/internal/lsp/cache/errors.go @@ -244,7 +244,7 @@ func onlyDeletions(fixes []source.SuggestedFix) bool { func typesCodeHref(snapshot *snapshot, code typesinternal.ErrorCode) string { target := snapshot.View().Options().LinkTarget - return fmt.Sprintf("https://%s/golang.org/x/tools/internal/typesinternal#%s", target, code.String()) + return source.BuildLink(target, "golang.org/x/tools/internal/typesinternal", code.String()) } func suggestedAnalysisFixes(snapshot *snapshot, pkg *pkg, diag *analysis.Diagnostic, kinds []protocol.CodeActionKind) ([]source.SuggestedFix, error) {