go/internal/lsp/cache
Robert Findley d303668635 internal/lsp/cache: use cached parsed files for symbols, if available
Optimize building the symbol index for a file, in two ways:
 - use the cached full parse tree, if it already exists
 - if it doesn't exist, optimize parsing by skipping both comments and
   object resolution, which aren't necessary for symbols

This results in around 3x faster initial indexing of symbols. In my
manual testing, indexing of Kubernetes went from 16s->5s, and indexing
of x/tools went from 2.4s->700ms.

Also fix a typo in gopls/internal/regtest/bench/bench_test.go.

Fixes #52602

Change-Id: I0893e95410be96e94e5e9dee7a3aab30b59c19c5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/403679
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2022-05-09 17:04:06 +00:00
..
analysis.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
cache.go internal/template: identify template files by the templateExtensions option 2022-01-13 17:30:17 +00:00
check.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
error_test.go internal/lsp/cache: split up sourceDiagnostics 2021-03-02 02:05:13 +00:00
errors.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
imports.go internal/lsp/cache: use -workfile on 1.18 2022-02-04 14:03:59 +00:00
keys.go internal/lsp: decouple client and server debug 2020-06-11 13:49:48 +00:00
load.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
metadata.go gopls: wire in LangVersion and ModulePath for gofumpt formatting 2022-02-24 18:08:50 +00:00
mod.go gopls, internal/lsp: gofmt 2022-04-12 17:41:31 +00:00
mod_tidy.go internal/lsp/cache: remove unused code 2022-03-17 13:53:34 +00:00
os_darwin.go internal/lsp/cache: clarify an error message about mismatching casing 2021-08-03 17:18:10 +00:00
os_windows.go internal/lsp/cache: clarify an error message about mismatching casing 2021-08-03 17:18:10 +00:00
parse.go internal/lsp: factor out go/token wrapper into a safetoken package 2022-05-09 17:03:37 +00:00
parse_test.go internal/lsp/cache: trim more stuff in ParseExported mode 2021-05-11 17:48:41 +00:00
parsemode_go116.go internal/lsp/cache: use cached parsed files for symbols, if available 2022-05-09 17:04:06 +00:00
parsemode_go117.go internal/lsp/cache: use cached parsed files for symbols, if available 2022-05-09 17:04:06 +00:00
pkg.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
session.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
snapshot.go internal/lsp/cache: invalidate packages that have added files 2022-05-02 22:20:22 +00:00
symbols.go internal/lsp/cache: use cached parsed files for symbols, if available 2022-05-09 17:04:06 +00:00
view.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
view_test.go internal/lsp/cache: always consider go.work files for ws expansion 2022-03-07 16:11:49 +00:00
workspace.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
workspace_test.go internal/lsp/cache: construct workspace even when go.work has error 2022-03-03 21:30:30 +00:00