go/gopls/internal/lsp/source
Alan Donovan 2592a854ec gopls/internal/lsp: simplify KnownPackages
This change simplifies the two functions called KnownPackages,
and renames one of them.

The first, source.KnownPackages, is a standalone function
called in exactly one place: ListKnownPackages.
It has been renamed KnownPackagePaths to distinguish
from the other and to make clear that it returns only
metadata. Its implementation could be greatly simplified
in a follow-up, as noted. In the meantime, one obviously
wrong use of ImportSpec.Path.Value (a quoted string literal!)
as an package (not import!) path was fixed, and the package
name was obtained directly, not via CompiledGoFiles.

The second, Snapshot.KnownPackagePaths, is called from two places.
This CL eliminates one of them: stubMethods used it apparently
only to populate a field of missingInterface (pkg) that was unused.
The other call (from 'implementations') is something that should
eventually go away as we incrementalize; in any case it doesn't
rely on the undocumented ordering invariant established by the
implementation. This change removes the ordering invariant,
documents the lack of order, and removes the ordering logic.

Change-Id: Ia515a62c2d78276b3344f2880c22746b2c06ff64
Reviewed-on: https://go-review.googlesource.com/c/tools/+/451675
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-11-18 17:22:07 +00:00
..
completion gopls/internal/lsp: simplify KnownPackages 2022-11-18 17:22:07 +00:00
add_import.go gopls: migrate internal/lsp to gopls/internal/lsp 2022-09-07 16:44:44 +00:00
api_json.go internal/lsp/cache: remove support for invalid metadata 2022-11-18 17:16:01 +00:00
call_hierarchy.go gopls/internal/lsp/cache: use Package.FileSet where possible 2022-11-11 15:24:32 +00:00
code_lens.go gopls/internal/span: move internal/span into gopls 2022-10-07 14:50:44 +00:00
comment.go gopls: migrate internal/lsp to gopls/internal/lsp 2022-09-07 16:44:44 +00:00
comment_go118.go gopls: migrate internal/lsp to gopls/internal/lsp 2022-09-07 16:44:44 +00:00
comment_go118_test.go gopls: migrate internal/lsp to gopls/internal/lsp 2022-09-07 16:44:44 +00:00
diagnostics.go gopls/internal/span: move internal/span into gopls 2022-10-07 14:50:44 +00:00
extract.go all: fix a few function names on comments 2022-10-10 13:22:38 +00:00
fix.go gopls/internal/lsp/cache: use Package.FileSet where possible 2022-11-11 15:24:32 +00:00
folding_range.go gopls: migrate internal/lsp to gopls/internal/lsp 2022-09-07 16:44:44 +00:00
format.go gopls/internal/lsp/cache: use Package.FileSet where possible 2022-11-11 15:24:32 +00:00
format_test.go gopls: migrate internal/lsp to gopls/internal/lsp 2022-09-07 16:44:44 +00:00
gc_annotations.go gopls/internal/span: move internal/span into gopls 2022-10-07 14:50:44 +00:00
highlight.go gopls/internal/lsp/cache: use Package.FileSet where possible 2022-11-11 15:24:32 +00:00
hover.go gopls/internal/lsp/cache: use Package.FileSet where possible 2022-11-11 15:24:32 +00:00
identifier.go gopls/internal/lsp/cache: use Package.FileSet where possible 2022-11-11 15:24:32 +00:00
identifier_test.go gopls: migrate internal/lsp to gopls/internal/lsp 2022-09-07 16:44:44 +00:00
implementation.go gopls/internal/lsp/cache: use Package.FileSet where possible 2022-11-11 15:24:32 +00:00
inlay_hint.go gopls: migrate internal/lsp to gopls/internal/lsp 2022-09-07 16:44:44 +00:00
known_packages.go gopls/internal/lsp: simplify KnownPackages 2022-11-18 17:22:07 +00:00
options.go internal/lsp/cache: remove support for invalid metadata 2022-11-18 17:16:01 +00:00
options_test.go gopls: migrate internal/lsp to gopls/internal/lsp 2022-09-07 16:44:44 +00:00
references.go gopls/internal/lsp/cache: use Package.FileSet where possible 2022-11-11 15:24:32 +00:00
rename.go gopls/internal/lsp/cache: use Package.FileSet where possible 2022-11-11 15:24:32 +00:00
rename_check.go gopls/internal/lsp/cache: use Package.FileSet where possible 2022-11-11 15:24:32 +00:00
signature_help.go gopls/internal/lsp/cache: use Package.FileSet where possible 2022-11-11 15:24:32 +00:00
source_test.go internal/diff: ToUnified may fail 2022-10-07 15:16:55 +00:00
stub.go gopls/internal/lsp: simplify KnownPackages 2022-11-18 17:22:07 +00:00
symbols.go internal/lsp/source: derive document symbols from syntax alone 2022-09-23 13:51:08 +00:00
types_format.go gopls/internal/lsp/cache: use Package.FileSet where possible 2022-11-11 15:24:32 +00:00
util.go gopls/internal/lsp/cache: use Package.FileSet where possible 2022-11-11 15:24:32 +00:00
util_test.go gopls/internal/span: move internal/span into gopls 2022-10-07 14:50:44 +00:00
view.go gopls/internal/lsp: simplify KnownPackages 2022-11-18 17:22:07 +00:00
workspace_symbol.go gopls/internal/lsp/cache: use typed strings (PackagePath et al) throughout 2022-11-11 03:59:42 +00:00
workspace_symbol_test.go gopls: migrate internal/lsp to gopls/internal/lsp 2022-09-07 16:44:44 +00:00