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

Closed
myitcv opened this issue May 2, 2019 · 2 comments
Closed

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

myitcv opened this issue May 2, 2019 · 2 comments

Comments

@myitcv
Copy link
Member

@myitcv myitcv commented May 2, 2019

$ go version
go version go1.12.4 linux/amd64
$ go list -m golang.org/x/tools
golang.org/x/tools 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.

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 7, 2019

Change https://golang.org/cl/181123 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-on: https://go-review.googlesource.com/c/tools/+/181123
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
@stamblerre
Copy link
Contributor

@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.
Projects
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.