From 4bfb4c74ac90cc146b53ac8c4f95448c56af4f93 Mon Sep 17 00:00:00 2001 From: Muir Manders Date: Tue, 11 Jun 2019 04:52:54 +0000 Subject: [PATCH] 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 Run-TryBot: Rebecca Stambler --- internal/lsp/cache/load.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/lsp/cache/load.go b/internal/lsp/cache/load.go index 56e22a88536..f6522970892 100644 --- a/internal/lsp/cache/load.go +++ b/internal/lsp/cache/load.go @@ -130,7 +130,7 @@ func (v *view) parseImports(ctx context.Context, f *goFile) bool { return true } 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 } }