1
0
mirror of https://github.com/golang/go synced 2024-11-18 18:44:42 -07:00

internal/lsp: fix check for changed imports

We weren't comparing the right values when checking to see if a file's
import statements had changed. This was causing us to not refetch a
package's metadata when needed in certain cases. In particular, if you
typed out an import path by hand you would get stuck with "no metadata
for package" until you added or deleted another import line to trigger
metadata refresh.

Updates golang/go#32516, golang/go#32232

Change-Id: I1c99e9ee56d18f02c44c749d33679aa4e561c620
GitHub-Last-Rev: 20d46b30b520572b05e3228d9e43ba46dfd1be3d
GitHub-Pull-Request: golang/tools#112
Reviewed-on: https://go-review.googlesource.com/c/tools/+/181578
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
Muir Manders 2019-06-11 04:52:54 +00:00 committed by Rebecca Stambler
parent f8d1dee965
commit 4bfb4c74ac

View File

@ -130,7 +130,7 @@ func (v *view) parseImports(ctx context.Context, f *goFile) bool {
return true return true
} }
for i, importSpec := range f.imports { for i, importSpec := range f.imports {
if importSpec.Path.Value != f.imports[i].Path.Value { if importSpec.Path.Value != parsed.Imports[i].Path.Value {
return true return true
} }
} }