From 1a196f04970c04bea7d88492e2618c03b60d4789 Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Thu, 30 Jun 2022 10:50:45 -0400 Subject: [PATCH] internal/lsp/cache: don't build symbol info for non-Go files Our symbol query only searches Go files, so there is no point to building (broken) symbol information for non-Go files. Doing so introduces a lot more symbol handles that need to be tracked and walked. Change-Id: I96dd62766d079805fcb1d16eb361adfc0c31eea1 Reviewed-on: https://go-review.googlesource.com/c/tools/+/415199 Reviewed-by: Alan Donovan TryBot-Result: Gopher Robot Run-TryBot: Robert Findley gopls-CI: kokoro --- internal/lsp/cache/snapshot.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/lsp/cache/snapshot.go b/internal/lsp/cache/snapshot.go index 8194750b33..e94ad7ba09 100644 --- a/internal/lsp/cache/snapshot.go +++ b/internal/lsp/cache/snapshot.go @@ -1010,6 +1010,10 @@ func (s *snapshot) Symbols(ctx context.Context) map[span.URI][]source.Symbol { result = make(map[span.URI][]source.Symbol) ) s.files.Range(func(uri span.URI, f source.VersionedFileHandle) { + if s.View().FileKind(f) != source.Go { + return // workspace symbols currently supports only Go files. + } + // TODO(adonovan): upgrade errgroup and use group.SetLimit(nprocs). iolimit <- struct{}{} // acquire token group.Go(func() error {