x/tools/gopls: determine how frequently to reload packages with missing dependencies #36918
Currently, when a user's package has a dependency that we can't resolve, we try to reload the package on every key stroke. We take care not to re-check it unless the metadata has changed, but it's still expensive to call
I wonder if we might be able to somehow make use of the
@heschik: Is this a reasonable idea, or should we just stick with the current approach?
Now that we build PackageHandles in load, we can simplify a lot of our logic for rebuilding them and reloading metadata. The only possibly-significant change is the missing imports logic. Now that we always create package handles in load, we don't have to do the extra "sameSet" logic. If the package handle hasn't been invalidated since we last built it, we will keep the benefits of caching it. Otherwise, it will be rebuilt in load. Updates golang/go#36918 Change-Id: Ieb45898d248501e3cebdb95c8b518149ba7498e5 Reviewed-on: https://go-review.googlesource.com/c/tools/+/217157 Run-TryBot: Rebecca Stambler <email@example.com> Reviewed-by: Heschi Kreinick <firstname.lastname@example.org> TryBot-Result: Gobot Gobot <email@example.com>