Commit f477bf4
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 <[email protected]>
Reviewed-by: Robert Findley <[email protected]>
Run-TryBot: Alan Donovan <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>1 parent b72edd1 commit f477bf4
File tree
11 files changed
+333
-122
lines changed- gopls/internal
- lsp
- cache
- source
- completion
- testdata/unimported
- tests
- regtest/completion
11 files changed
+333
-122
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1113 | 1113 | | |
1114 | 1114 | | |
1115 | 1115 | | |
1116 | | - | |
1117 | | - | |
1118 | | - | |
1119 | | - | |
1120 | | - | |
1121 | | - | |
1122 | | - | |
1123 | | - | |
1124 | 1116 | | |
1125 | 1117 | | |
1126 | 1118 | | |
| |||
0 commit comments