Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: determine how frequently to reload packages with missing dependencies #36918

Open
stamblerre opened this issue Jan 31, 2020 · 1 comment

Comments

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Jan 31, 2020

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 packages.Load on every keystroke.

I wonder if we might be able to somehow make use of the goimports scanning logic in gopls to do this in a better way. It's possible that we can't do better in GOPATH mode (or in another build system), but I'd think we might be able to do something better in module mode.

@heschik: Is this a reasonable idea, or should we just stick with the current approach?

@stamblerre stamblerre added this to the gopls/v1.0.0 milestone Jan 31, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Jan 31, 2020

Change https://golang.org/cl/217157 mentions this issue: internal/lsp/cache: refactor functions that return PackageHandles

gopherbot pushed a commit to golang/tools that referenced this issue Feb 7, 2020
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 <rstambler@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@stamblerre stamblerre removed this from the gopls/v1.0.0 milestone Jun 24, 2020
@stamblerre stamblerre added the Thinking label Jul 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.