go/internal/lsp
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 internal/lsp: fix fillstruct for structs with unsafe.Pointer 2022-05-05 17:08:12 +00:00
browser
cache internal/lsp/cache: use cached parsed files for symbols, if available 2022-05-09 17:04:06 +00:00
cmd internal/lsp/cmd: change vulncheck to directly call the hook 2022-05-06 16:33:28 +00:00
command gopls, internal/lsp: gofmt 2022-04-12 17:41:31 +00:00
debug gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
diff
fake gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
fuzzy gopls, internal/lsp: gofmt 2022-04-12 17:41:31 +00:00
helper internal/lsp/protocol: update LSP definitions and stubs 2021-10-05 16:44:45 +00:00
lsppos internal/lsp: factor out go/token wrapper into a safetoken package 2022-05-09 17:03:37 +00:00
lsprpc gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
mod gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
progress gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
protocol gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
regtest gopls, internal/lsp: gofmt 2022-04-12 17:41:31 +00:00
safetoken internal/lsp: factor out go/token wrapper into a safetoken package 2022-05-09 17:03:37 +00:00
snippet lsp/completion: fix literal completions with type params 2022-04-26 02:30:39 +00:00
source internal/lsp: factor out go/token wrapper into a safetoken package 2022-05-09 17:03:37 +00:00
template gopls, internal/lsp: gofmt 2022-04-12 17:41:31 +00:00
testdata internal/lsp: fix fillstruct for structs with unsafe.Pointer 2022-05-05 17:08:12 +00:00
tests internal/lsp: add support for formatting go.work files 2022-02-15 17:15:32 +00:00
work gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
README.md
call_hierarchy.go
code_action.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
code_lens.go internal/lsp: honor the file kind provided by clients for overlays 2022-01-13 20:54:45 +00:00
command.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
completion.go internal/lsp: add completion for use directives 2022-03-10 23:20:43 +00:00
completion_test.go
debounce.go internal/lsp: adopt bcmills' suggestion for an improved debouncer API 2021-07-13 16:40:23 +00:00
debounce_test.go internal/lsp: adopt bcmills' suggestion for an improved debouncer API 2021-07-13 16:40:23 +00:00
definition.go internal/lsp: honor the file kind provided by clients for overlays 2022-01-13 20:54:45 +00:00
diagnostics.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
folding_range.go
format.go internal/lsp: add support for formatting go.work files 2022-02-15 17:15:32 +00:00
general.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
highlight.go internal/lsp: honor the file kind provided by clients for overlays 2022-01-13 20:54:45 +00:00
hover.go internal/lsp: add hover for go.work use statements 2022-03-04 19:55:36 +00:00
implementation.go
link.go internal/lsp: only linkify urls with http, https, and ftp schemes 2022-05-02 22:00:12 +00:00
lsp_test.go internal/lsp: use placeholders with prepare rename 2022-02-15 00:29:01 +00:00
references.go internal/lsp: honor the file kind provided by clients for overlays 2022-01-13 20:54:45 +00:00
rename.go internal/lsp: use placeholders with prepare rename 2022-02-15 00:29:01 +00:00
reset_golden.sh
semantic.go internal/lsp: factor out go/token wrapper into a safetoken package 2022-05-09 17:03:37 +00:00
server.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
server_gen.go internal/lsp: update LSP stubs, including provisional InlayHints 2022-03-16 22:16:36 +00:00
signature_help.go
symbols.go internal/lsp: honor the file kind provided by clients for overlays 2022-01-13 20:54:45 +00:00
text_synchronization.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
workspace.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
workspace_symbol.go

README.md

lsp

internal/lsp provides much of the Language Server Protocol (lsp) implementation for gopls.

Documentation for users and contributors can be found in the gopls/doc directory.