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/cmd/gopls: add implementation for textDocument/didSave #31796

myitcv opened this issue May 2, 2019 · 2 comments

x/tools/cmd/gopls: add implementation for textDocument/didSave #31796

myitcv opened this issue May 2, 2019 · 2 comments


Copy link

@myitcv myitcv commented May 2, 2019

$ go version
go version go1.12.4 linux/amd64
$ go list -m v0.0.0-20190429181656-7af746645d51

Per discussions with @ianthehat, if we add an implementation for textDocument/didSave we can implement logic within that method to invalidate the gopls cache when new imports are added to a package. i.e. we can check whether the imports in the file that was just saved are a subset of the current package cache and invalidate if not.

This will remove a category of "failures" with respect to completions returning no results.

Copy link

@gopherbot gopherbot commented Jun 7, 2019

Change mentions this issue: internal/lsp: add an implementation for textDocument/didSave

gopherbot pushed a commit to golang/tools that referenced this issue Jun 10, 2019
This change marks the overlay for a saved file as "on disk".
This will reduce the number of overlays we provide to go/packages, which
can be expensive.

Updates golang/go#31796, golang/go#32457

Change-Id: I8e69503ab80bba29caf4e42491d87e643bf17f1a
Reviewed-by: Ian Cottrell <>
Reviewed-by: Peter Weinberger <>
Copy link

@stamblerre stamblerre commented Jun 28, 2019

Closing this, as the above CL added an implementation of didSave, and the memoization related changes (upcoming) will handle invalidating the gopls cache using a different mechanism.

@stamblerre stamblerre closed this Jun 28, 2019
@golang golang locked and limited conversation to collaborators Jun 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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