go/internal/lsp/regtest
Rob Findley 6932d22acd internal/lsp/source: recursively search for qualified objects
When searching for references or renaming, we start from all packages
containing the current position. But as reported in golang/go#47564,
this fails if we're renaming an object in another package; we need to
start the search from the package containing the object definition.

This CL finds the missing packages by recursively searching all
locations we encounter. For now, this will cause us to consider the
object location, and may also help us behave correctly with respect to
build constraint variants in the future.

While at it, update the regtests to support renaming. This bug could
be exercised with marker tests, but it's good to have a regtest for
renaming anyway.

Fixes golang/go#47564

Change-Id: I5517e2aeaaa744fcc6b6b96ffbb0b2625b498ed5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/340472
Trust: Robert Findley <rfindley@google.com>
Trust: Suzy Mueller <suzmue@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2021-08-17 02:54:26 +00:00
..
doc.go internal/lsp: move gopls/internal/regtest -> internal/lsp/regtest 2021-04-23 16:19:37 +00:00
env.go internal/lsp/regtest: add a benchmark for didChange 2021-05-06 02:57:18 +00:00
env_test.go internal/lsp/regtest: add a benchmark for didChange 2021-05-06 02:57:18 +00:00
expectation.go internal/lsp/regtest: fix a panic TestResolveImportCycle 2021-07-09 17:21:04 +00:00
regtest.go internal/lsp/regtest: force GOPACKAGESDRIVER=off 2021-04-30 16:06:43 +00:00
runner.go internal/lsp/source: compute imports text edits from scratch 2021-07-22 17:13:07 +00:00
wrappers.go internal/lsp/source: recursively search for qualified objects 2021-08-17 02:54:26 +00:00