Skip to content

Commit

Permalink
internal/lsp/cache: don't build symbol info for non-Go files
Browse files Browse the repository at this point in the history
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 <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
  • Loading branch information
findleyr committed Jun 30, 2022
1 parent b84d509 commit 1a196f0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/lsp/cache/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1a196f0

Please sign in to comment.