1
0
mirror of https://github.com/golang/go synced 2024-11-18 21:44:45 -07:00
go/internal/lsp/mod
Rob Findley 20370b0cb4 internal/lsp: honor GOPRIVATE in documentLinks and go.mod hovers
Several fixes related to GOPRIVATE handling and links:
 + In Go source, fix links matching GOPRIVATE for external modules.
   Previously, in these cases we'd try to match <mod>@v1.2.3/<suffix>,
   which wasn't the correct input into the GOPRIVATE matching algorithm.
 + Similarly check GOPRIVATE for go.mod require statement hovers.
 + Likewise, for documentLink requests (both mod and source).
 + Move the existing hover regtest to link_test.go, and expand to cover
   all these cases.

Along the way, I encountered a couple apparent bugs, which I fixed:
 + Correctly handle the case where there is only one require in a go.mod
   file. This was exercised by the regtest, so took some debugging.
 + Only format links [like](this) if the requested format is actually
   markdown.

Fixes golang/go#36998

Change-Id: I92011821f646f2a7449dcca619483f83bdeb54b0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/238029
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-06-18 13:42:42 +00:00
..
testdata/unchanged internal/lsp/tests: fix reset of golden files 2020-02-19 14:42:13 +00:00
code_lens.go internal/lsp: use a new temporary go.mod for every go list call 2020-06-18 02:37:23 +00:00
diagnostics.go internal/lsp: use a new temporary go.mod for every go list call 2020-06-18 02:37:23 +00:00
format.go internal/lsp: await the initial workspace load in ModHandle 2020-06-12 18:21:55 +00:00
hover.go internal/lsp: honor GOPRIVATE in documentLinks and go.mod hovers 2020-06-18 13:42:42 +00:00
mod_test.go internal/lsp: use a new temporary go.mod for every go list call 2020-06-18 02:37:23 +00:00