go/internal/lsp/source/completion
Rob Findley 07bc1bf47f internal/lsp: in degraded mode, limit the workspace to active packages
In my testing, the gopls degraded memory mode (currently set via
"memoryMode": "DegradeClosed") did not save as much memory as expected
due to still type checking all packages in the workspace (even if in
ParseExported mode). It is also annoying to get incomplete results from
references and renaming.

I think we can (and should) fix both problems: don't even consider
packages that aren't 'reachable' via open files, but fully type check
the reverse transitive closure of the packages you're working on. This
CL does exactly that, by swapping out the concept of 'workspace
packages' with 'active packages'.

In testing, this decreased my memory footprint while working on std by
3-4x when compared to normal mode, and 2x when compared to the previous
implementation of DegradeClosed.

It still needs more testing before we move this option out of
experimental.

For golang/go#46902

Change-Id: I1e319d0b1607d344d27e797ce32de057d7a583f9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/336410
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2021-07-26 20:36:31 +00:00
..
builtin.go lsp/completion: support completing to Elem() types 2021-06-09 15:58:30 +00:00
completion.go lsp/completion: support completing to Elem() types 2021-06-09 15:58:30 +00:00
deep_completion.go lsp/completion: support completing to Elem() types 2021-06-09 15:58:30 +00:00
deep_completion_test.go internal/lsp/source: move completion to its own package 2020-09-08 19:19:08 +00:00
format.go internal/lsp/source: compute imports text edits from scratch 2021-07-22 17:13:07 +00:00
keywords.go internal/lsp/source/completion: remove "completion_" prefix from files 2020-10-30 17:45:15 +00:00
labels.go internal/lsp/source/completion: remove "completion_" prefix from files 2020-10-30 17:45:15 +00:00
literal.go lsp/completion: reorganize how we track candidate type mods 2021-06-09 15:58:13 +00:00
package.go internal/lsp: in degraded mode, limit the workspace to active packages 2021-07-26 20:36:31 +00:00
package_test.go internal/lsp/source/completion: suggest only valid package names 2021-04-27 19:53:45 +00:00
postfix_snippets.go lsp/completion: fix postfix completions preceding assignments 2021-04-26 15:26:58 +00:00
printf.go internal/lsp: fix some incorrect spelling 2020-11-24 11:59:21 +00:00
printf_test.go internal/lsp/source/completion: remove "completion_" prefix from files 2020-10-30 17:45:15 +00:00
snippet.go lsp/completion: reorganize how we track candidate type mods 2021-06-09 15:58:13 +00:00
statements.go internal/lsp: add snippet completion for t.Fatal errs 2021-03-15 21:39:02 +00:00
util.go internal/lsp/source/completion: add postfix snippet completions 2021-03-29 17:27:46 +00:00
util_test.go internal/lsp/source: move completion to its own package 2020-09-08 19:19:08 +00:00