commit | 98f1b4dee82ca3ded542b3c37a62f58f0eb744b7 | [log] [tgz] |
---|---|---|
author | Rob Findley <rfindley@google.com> | Wed May 31 17:58:19 2023 -0400 |
committer | Robert Findley <rfindley@google.com> | Wed May 31 22:34:27 2023 +0000 |
tree | fe1c9140dd38098ac42f7b409a45d352c0a7d375 | |
parent | a260315e300ac46cc74b461bb418e4a800ee55bf [diff] [blame] |
gopls/internal/lsp/cache: check number of orphaned files after filtering I noticed redundant "reloadOrphanedFiles reloading" logs in https://storage.googleapis.com/go-build-log/0b9348fc/openbsd-amd64-72_04342286.log This is because we were checking for no reloadable files before filtering out unloadable files, not after. Fix this logic error. Change-Id: Ib7ad122bb7f96fdf53474c329fac1ec8ec0e1ef3 Reviewed-on: https://go-review.googlesource.com/c/tools/+/499755 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Robert Findley <rfindley@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
diff --git a/gopls/internal/lsp/cache/snapshot.go b/gopls/internal/lsp/cache/snapshot.go index 7e0a9ba..bff3dc1 100644 --- a/gopls/internal/lsp/cache/snapshot.go +++ b/gopls/internal/lsp/cache/snapshot.go
@@ -1605,9 +1605,6 @@ files = append(files, o) } } - if len(files) == 0 { - return nil - } // Filter to files that are not known to be unloadable. s.mu.Lock() @@ -1620,6 +1617,10 @@ files = loadable s.mu.Unlock() + if len(files) == 0 { + return nil + } + var uris []span.URI for _, file := range files { uris = append(uris, file.URI())