Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gopls/internal/lsp/source/completion: avoid Snapshot.CachedPackages
This change removes the last use of CachedPackages, from unimported completions. Instead, we find candidates in the workspace using the metadata, then perform a quick parse of each file to extract the names of exported package members. The quick parse first uses the scanner to find the function bodies and then deletes them, eliminating most of the input to the actual scanner. Unfortunately we can't simply load export data for the relevant package (which should be quick) and use its type information in the usual way, because the deep completion machinery is tightly coupled to the notion of a single realm of objects. We can only display syntactic information (e.g. var/func/const/type). Thus this change is a slight functional regression from the old behavior which presented accurate type information. Fixes golang/go#58663 Change-Id: Ia750785f51ea82ddea7c7849c2565ed6394df467 Reviewed-on: https://go-review.googlesource.com/c/tools/+/472183 Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
- Loading branch information