Skip to content

Commit 1a196f0

Browse files
committed
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 <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Robert Findley <[email protected]> gopls-CI: kokoro <[email protected]>
1 parent b84d509 commit 1a196f0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/lsp/cache/snapshot.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,10 @@ func (s *snapshot) Symbols(ctx context.Context) map[span.URI][]source.Symbol {
10101010
result = make(map[span.URI][]source.Symbol)
10111011
)
10121012
s.files.Range(func(uri span.URI, f source.VersionedFileHandle) {
1013+
if s.View().FileKind(f) != source.Go {
1014+
return // workspace symbols currently supports only Go files.
1015+
}
1016+
10131017
// TODO(adonovan): upgrade errgroup and use group.SetLimit(nprocs).
10141018
iolimit <- struct{}{} // acquire token
10151019
group.Go(func() error {

0 commit comments

Comments
 (0)