We can use a property that split does a dfs search for the key before
doing an actual work. This allows us to do a low-cost early return if
there is no key to delete.
Change-Id: I6ed8068945f9f2dacc356d72b18afce04ec89a3c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/413659
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Now that the workspace directory uses Snapshot.Destroy
to clean up (see https://go-review.googlesource.com/c/tools/+/414499)
there is no need for this feature.
Change-Id: Id5782273ce5030b4fb8f3b66a8d16a45a831ed91
Reviewed-on: https://go-review.googlesource.com/c/tools/+/414500
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Alan Donovan <adonovan@google.com>
This change causes (*snapshot).getWorkspaceDir to create a temporary
directory directly, rather than via the Store/Generation/Handle
mechanism. The work is done at most once per snapshot, and the
directory is deleted in Snapshot.Destroy.
This removes the last remaining use of Handle's cleanup mechanism,
which will be deleted in a follow-up.
Change-Id: I32f09a67846d9b5577cb8849b226427f86443303
Reviewed-on: https://go-review.googlesource.com/c/tools/+/414499
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
In Go 1.18 types.AssignableTo() started reporting that an invalid type
is assignable to any interface. *types.PkgName (i.e. an import at the
top of the file) has an invalid type for its Type(), so we started
thinking all in scope imports were great candidates when the expected
type was an interface.
Fix by wrapping the AssignableTo (and AssertableTo) to explicitly
return false if either operand is invalid.
Updates golang/go#53595
Change-Id: Ie5a84b7f410ff5c73c6b7870e052bafaf3e21e99
Reviewed-on: https://go-review.googlesource.com/c/tools/+/415595
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
This adds a snippet that applies to variables of type chan.
When used, it replaces `channel.range!` with the following snippet:
```
for e := range channel {
|
}
```
Where `|` indicates the location of the cursor.
Change-Id: I8b2f889b22b9f2c292041e5ca5f63c5d0ca98f11
GitHub-Last-Rev: 9cb894be80
GitHub-Pull-Request: golang/tools#386
Reviewed-on: https://go-review.googlesource.com/c/tools/+/414194
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
This allows reducing critical section of `g.store.mu` as the vast
majority of entries do not rely on generation-based GC.
Change-Id: I985af0b38504ddedb22649290deac91797577b75
Reviewed-on: https://go-review.googlesource.com/c/tools/+/413656
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
This on average reduces latency from 25ms to 12ms on internal codebase.
Updates golang/go#45686
Change-Id: I49c8f09f8e54b7b486d7ff7eb8f4ba9f0d90b278
Reviewed-on: https://go-review.googlesource.com/c/tools/+/413655
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
This function was actually left behind, after making suggested changes
to CL 413683.
Change-Id: I6933e870ded9da5af06724c28839c37d58fb4cdc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/414856
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Selectively upgrade only staticcheck, to pick up fixes for support to
generic code.
Change-Id: Ia625c4d46780139aa6e70447eebe1b6d476d4722
Reviewed-on: https://go-review.googlesource.com/c/tools/+/415495
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Include a suggested fix with the diagnostic for unkeyed composite
literals. This suggested fix will add the name of each of the
fields.
For golang/go#53062
Change-Id: I0c33191ff3cf66c95a9a055848274cc2b0c38224
Reviewed-on: https://go-review.googlesource.com/c/tools/+/414674
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Add text edits that a user can accept to make the unkeyed composite
literals keyed from the inlay hints. The text edits modify all of
the unkeyed fields in a composite literal, since a mixture of keyed
and unkeyed fields are not allowed.
Change-Id: I0683fbaa5e22bc004b91c98fc09e495e797826ee
Reviewed-on: https://go-review.googlesource.com/c/tools/+/414855
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Our symbol query only searches Go files, so there is no point to
building (broken) symbol information for non-Go files. Doing so
introduces a lot more symbol handles that need to be tracked and walked.
Change-Id: I96dd62766d079805fcb1d16eb361adfc0c31eea1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/415199
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
This change should have been included in
https://go-review.googlesource.com/c/tools/+/415057
but I hastily submitted it without a CI run
thinking "how can a doc only change break something?".
Well now I know. Sorry. :(
Change-Id: Ib0fd25fddd7f9580961b44dcad032d4851684f63
Reviewed-on: https://go-review.googlesource.com/c/tools/+/415058
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
...and don't claim that the most compact field order is optimal.
The exception is relatively obscure, but the fact that it exists
is important because it means it is not safe to apply the code
transformation unconditionally.
Change-Id: I391fbc1872b578d5340dd7c8fded48be30b820e0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/415057
Reviewed-by: Robert Findley <rfindley@google.com>
This is an optimization to avoid calculating inlayhints that are
not in the requested range.
Change-Id: I311f297d2998ae7d0db822eac540b1c12cae6e23
Reviewed-on: https://go-review.googlesource.com/c/tools/+/412455
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Add some additional logging to help debug golang/go#53586
For golang/go#53586
Change-Id: I0574fb01be47b265cd6e412855794bc2cb836dff
Reviewed-on: https://go-review.googlesource.com/c/tools/+/414854
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
Add regtests for inlay hints to verify we can turn on
and off different inlay hints.
Change-Id: Id88450c40c048b6c2544d22a0d3eadb57b70a723
Reviewed-on: https://go-review.googlesource.com/c/tools/+/411911
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Find needs to invoke the go command to find the package export data.
It cannot rely on GOPATH-based file location heuristics.
This has the nice side effect of automatically compiling the code,
removing the possibility of stale export data.
Ideally Find would use go/packages, but go/packages imports
this package for the export data parser (not for Find itself),
so we have to make do with an explicit go command invocation.
Marked both Find and NewImporter deprecated: using go/packages
will be faster for nearly all use cases, because it can gather info
about multiple packages in a single go command invocation.
They are essentially unused anyway.
Removed the file name print from the example because
the file may be in the cache, in which case it will not be
named "fmt.a".
Change-Id: I7940c90e230b22df9dcbfc8103a69a2d18df3bb0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/310515
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
This change causes the satisfy constraint pass to correctly handle
type parameters. In nearly all cases this means calling coreType(T)
instead of T.Underlying(). This, and the addition of cases for
C[T] and C[X, Y], should make the code robust to generic syntax.
However, it is still not clear what the semantics of constraints
are for the renaming tool. That work is left to a follow-up.
Also, add a test suite that exercises all the basic operators,
using generics in each case.
Fixesgolang/go#52940
Change-Id: Ic1261eb551c99b582c35fadaa148b979532588df
Reviewed-on: https://go-review.googlesource.com/c/tools/+/413690
Reviewed-by: Robert Findley <rfindley@google.com>
Unlike generational handles, when reference counted handles are evicted
from the Store we don't know that they are also no longer in use by
active goroutines. Destroying them causes goroutine leaks.
Also fix a data race because Handle.mu was not acquired in the release
func returned by GetHandle.
Change-Id: Ida7bb6961a035dd24ef8566c7e4faa6890296b5b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/414455
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Change-Id: I086edda41c57b603afa660afb9396e17ba6c1a36
Reviewed-on: https://go-review.googlesource.com/c/tools/+/414074
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
When setting new metadata for a package ID, we invalidate the
corresponding type-checked packages. Whenever we invalidate a package,
we must also invalidate its reverse transitive closure. Otherwise we may
end up in a scenario where the go/types import graph does not match
gopls' view of the import graph.
Change-Id: I8db6ff3e4a722656e6dde7907e7c0470375c4847
Reviewed-on: https://go-review.googlesource.com/c/tools/+/413683
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
If gopls believes it has valid metadata for a package, don't set new
metadata. This is consistent with previous behavior that was changed in
CL 340851.
In principle this shouldn't matter, but in practice there are places
where gopls doesn't yet want to invalidate packages, *even though* their
metadata may have changed (such as while editing a go.mod file before
saving). In the future we should eliminate these places, but for now we
should let snapshot.clone control this invalidation.
This also reduces the number of type-checked packages we invalidate on
load.
Change-Id: I0cc9bd4186245bec401332198de0047ff37e7ec7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/413681
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>
Previously, gopls would fall back on a gopath resolver when running
goimports from a directory containing go.work (but not go.mod). Fix this
by update the code to recognize that GOWORK also puts goimports into
module mode.
All the work to _support_ go.work had already been done, but the tests
were only passing because they were setting GO111MODULE=on explicitly
(and therefore GOMOD=/dev/null was satisfying the pre-existing check).
Also add a test for the regression in gopls.
Fixesgolang/go#52784
Change-Id: I31df6f71a949a5668e8dc001b3ee25ad26f2f927
Reviewed-on: https://go-review.googlesource.com/c/tools/+/413689
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
To properly format these field names in the vscode config ui
these fields should be camel case.
Change-Id: I3b8b8fb6371172ecb464710f7d91b9fc67e0ed42
Reviewed-on: https://go-review.googlesource.com/c/tools/+/413684
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
The final LSP spec for 3.17 changed the name of ViewPort to Range
for both InlayHints and InlineValues. This manually updates just
these fields in our protocol.
Change-Id: I0303a36536016ca59c87dc45f55fadcd80e72bfc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/413677
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
This on average reduces latency from 34ms to 25ms on internal codebase.
Updates golang/go#45686
Change-Id: I57b05e5679620d8481b1f1a051645cf1cc00aca5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/413654
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
Use treap (https://en.wikipedia.org/wiki/Treap) as a persistent map to avoid copying s.goFiles across generations.
Maintain an additional s.parseKeysByURIMap to avoid scanning s.goFiles on individual file's content invalidation.
This on average reduces didChange latency on internal codebase from 160ms to 150ms.
In a followup the same approach can be used to avoid copying s.files, s.packages, and s.knownSubdirs.
Updates golang/go#45686
Change-Id: Ic4a9b3c8fb2b66256f224adf9896ddcaaa6865b1
GitHub-Last-Rev: 0abd2570ae
GitHub-Pull-Request: golang/tools#382
Reviewed-on: https://go-review.googlesource.com/c/tools/+/411554
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This change adds user settings for enabling inlay hints, modeled
roughly after analyzers. This will allow users to turn on specific
inlay hints that they like and leave others off.
With all of the inlay hints turned off by default, we can now enable
inlay hints.
Change-Id: Ie5dfcbbab1e0b7312eafcc4aa08cb4fe8a83fc31
Reviewed-on: https://go-review.googlesource.com/c/tools/+/411906
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Change-Id: Ie25f67fd98d34b0a907bd13357e2643b1b79443b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/412914
Reviewed-by: Alex Rakoczy <alex@golang.org>
Auto-Submit: Daniel Martí <mvdan@mvdan.cc>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Package metadata is small; there is no reason not to keep it around, and
pruning it on every clone is needless work.
Change-Id: I9ea73315cc6b673625f0f7defe1fd61c2e1eb123
Reviewed-on: https://go-review.googlesource.com/c/tools/+/373695
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
When using Go workspaces, the go.work file should be used to determine
which packages are workspace packages.
For golang/go#48929
Change-Id: I1a8753ab7887daf193e093fca5070b4cc250a245
Reviewed-on: https://go-review.googlesource.com/c/tools/+/400822
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
This change adds a fast-path check for the common case:
"file:", lowercase, followed by a simple POSIX absolute
file name without special characters.
This function used to account for 1% of CPU on the DidChange
benchmark (and I'm sure I've seen higher fractions on other
tests--but perhaps that was before the clone optimizations?).
It was tested by adding an assertion that it agrees with the
slow path and running all our tests.
Change-Id: I15492b8a317715468870b00041bf8f6b0bb53bb2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/411900
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Minor cleanups based on studying the code in preparation
for saving a persistent index:
- Remove unused error result from Symbols method.
- Remove unnecessary fields from symbolHandle.
- Add various explanatory comments.
- In workspace_symbols.go:
- separate extract and match phases of collectSymbols clearly
- replace symbolCollector and matchWorker types by simple parameters
- combine loops (roots, buildMatcher)
- move buildMatcher creation down to where it is needed.
Change-Id: Ifcad61a9a8c7d70f573024bcfa76d476552ee428
Reviewed-on: https://go-review.googlesource.com/c/tools/+/412822
Reviewed-by: Robert Findley <rfindley@google.com>
Update References to detect if the package is referenced and a regtest to test within and external package references.
Updates golang/go#41567
Change-Id: I607a47bf15f1c9f8236336f795fcef081db49d6a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/408714
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Dylan Le <dungtuanle@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
The tooltip for truncated inlay hint labels is redundant
with the hover state of the target identifier. This matches
the behavior of inlay hint implementations in other languages.
Change-Id: I209054f8c65df504cae67121e3cbc3eacaf02710
Reviewed-on: https://go-review.googlesource.com/c/tools/+/413417
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This will show inferred type information for generic function
call expressions.
Example:
SumNumbers<[string, int64]>(ints)
For golang/go#52343
Change-Id: I05595f236626e8fb3666af5160611e074e8265a4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/412994
Reviewed-by: Suzy Mueller <suzmue@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Allows a 'file=' query to load a single file even when it is outside of
GOPATH or a module.
Fixesgolang/go#49949
Change-Id: I519f1412923dfc1d2504ec49620d10c823e5c0dc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/369014
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This change reduces the sizes of the critical section
in traces.ProcessEvent, in particular moving allocations
ahead of Lock. This reduces the contention according
to the trace profiler.
See https://go-review.googlesource.com/c/go/+/411909 for
another reduction in contention. The largest remaining
contention is Handle.Get, which thousands of goroutines
wait for because we initiate typechecking top down.
(Second attempt at https://go-review.googlesource.com/c/tools/+/411910,
reverted in https://go-review.googlesource.com/c/tools/+/412694.
The changes to Generation.Bind have been dropped.)
Change-Id: Ia9050c97bd12d2d75055f8d1dfcda3ef1f5ad334
Reviewed-on: https://go-review.googlesource.com/c/tools/+/412820
Run-TryBot: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Add inlay hints for composite literal types. This will show type
information for composite literals with no explicit types.
Example:
<struct {in, want string}>{"hello", "goodbye"}
For golang/go#52343
Change-Id: Ia1f03b82669387c864353b8033940759fa1128e7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/411905
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
This change parallelizes the buildSymbolHandle().Get computation for
each file, with 2xGOMAXPROCS goroutines, since it is a mix of I/O (read)
and CPU (parse). (The symbolize AST walk happens in other goroutines.)
This reduces the time for the source.WorkspaceSymbols trace task
applied to kubernetes from 3981ms to 630ms (6x faster).
Change-Id: I5f1ee4afc2f6b2dd752791a30d33a21f50180a9c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/412818
Reviewed-by: Robert Findley <rfindley@google.com>
The region name includes the type of the key, such as packageHandleKey
or actionHandleKey, so we can separate these deferred computations
into their own buckets.
Change-Id: I0359127ccf47b158f353fae2bf74ba000668a40b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/412817
Run-TryBot: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Now that the entire metadata graph and workspace packages are derived
from metadata, there should be no need to validate coherency.
This results in a small improvement to didChange benchmarking (within
statistical noise).
For golang/go#45686
Change-Id: I32683e025f42d768d62864683e55d4c00146a31c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/340855
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Since ids is derived from metadata, we should not have to walk ids to
see which metadata is still active. Just compute metadata updates
directly.
Benchmark (didChange in k8s): ~45ms->41ms
For golang/go#45686
Change-Id: Id557ed3f2e05c903e4bb3f3f6a4af864751c4546
Reviewed-on: https://go-review.googlesource.com/c/tools/+/340854
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
We with immutable metadata, we don't need to clone if nothing was
invalidated.
Benchmark (didChange in k8s): 65ms->45ms
For golang/go#45686
Change-Id: I6b5e764c53a35784fd8c7b43bc26361f4ee8d928
Reviewed-on: https://go-review.googlesource.com/c/tools/+/340853
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
The Metadata type was mutated in exactly one place: when setting the
ShouldLoad bit after package loading completes. Address this by cloning
the metadata graph when clearing ShouldLoad. After this change, metadata
graphs and the data within them are immutable.
This also fixes a range-variable capture bug in load.go: previously we
were deferring a call to clearShouldLoad for the range variable scope.
After this change, we properly clear the ShouldLoad bit for all scopes.
Change-Id: I8f9140a490f81fbabacfc9e0102d9c638c7fbb37
Reviewed-on: https://go-review.googlesource.com/c/tools/+/400821
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>