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
Labels
Documentation FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@myitcv
Copy link
Member

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.

@myitcv myitcv added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. gopls Issues related to the Go language server, gopls. labels May 2, 2019
@gopherbot gopherbot added this to the Unreleased milestone May 2, 2019
@gopherbot
Copy link

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

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.

@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.
Labels
Documentation FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants