diff options
author | Robert Findley <rfindley@google.com> | 2022-12-27 14:12:15 -0500 |
---|---|---|
committer | Robert Findley <rfindley@google.com> | 2022-12-29 14:49:24 +0000 |
commit | 0e1d01321381a6614cf23ae5b146eaa8e4c2040a (patch) | |
tree | 4a878fb2f1a9f427735a4047054cf009cf5cb130 /gopls/internal/regtest/completion/completion_test.go | |
parent | 2f31dd473a3cd96dbddb9da93b58ac55f1a2450e (diff) | |
download | golang-x-tools-0e1d01321381a6614cf23ae5b146eaa8e4c2040a.tar.gz |
gopls/internal/lsp/cache: recreate Views when their root changes
A View is defined by a Go environment along with a go.work file, go.mod
file, or directory in GOPATH. When the environment changes via
didChangeConfiguration, we recreate the View. Before this CL we didn't
do the same when a view-defining go.mod or go.work was added or removed.
Instead, we relied on workspace and snapshot invalidation to get us to
the correct state. But since we reinitialize the view on these changes
anyway there is little value in preserving any existing view state, and
in fact doing so may lead to latent bugs. For example, deleting a
go.work file caused the workspace to fall back to 'file system' mode,
which may not be the same state that would result from restarting gopls.
This change also moves us toward a model where we can have a dynamic set
of views covering the full set of open files, not 1:1 with workspace
folders.
Also:
- move the dirURI helper function to span.Dir, which is more
discoverable
- fix a bug where the wrong filter function was used to define the
workspace
- remove Session.optionsOverride, which was unused
For golang/go#55331
Change-Id: Id108e848cdd942c34eda0a339d2c8a517c89c7de
Reviewed-on: https://go-review.googlesource.com/c/tools/+/459635
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Diffstat (limited to 'gopls/internal/regtest/completion/completion_test.go')
0 files changed, 0 insertions, 0 deletions