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: track saved go.{mod,sum} files in the workspace #43305

Open
findleyr opened this issue Dec 21, 2020 · 1 comment
Open

x/tools/gopls: track saved go.{mod,sum} files in the workspace #43305

findleyr opened this issue Dec 21, 2020 · 1 comment
Labels
Milestone

Comments

@findleyr
Copy link
Contributor

@findleyr findleyr commented Dec 21, 2020

gopls currently invalidates package metadata on any change to a go.mod file. This can lead to a poor experience editing go.mod files by hand, as described in #42529. Fixing #42815 could make this the case for go.sum files as well (though editing go.sum files by hand is not advisable).

We're going to mitigate some of the pain by only invalidating metadata when a go.mod or go.sum is saved. However, this can lead to some confusing edge cases, such as the go mod why hover text referencing a module layout that is inconsistent with the loaded metadata.

On balance these confusing edge cases are likely to be rare and less severe than the current problems editing go.mod files, so we'll proceed with this fix. Longer term, we should change the logic of the workspace to only track saved files, so that features can cleanly operate on just the saved mod/sum files by using the workspace, and can access overlaid content by using the snapshot.

CC @stamblerre @heschik

@findleyr findleyr added this to the gopls/v0.6.2 milestone Dec 21, 2020
@findleyr findleyr modified the milestones: gopls/v0.6.2, gopls/v1.0.0 Dec 21, 2020
@findleyr
Copy link
Contributor Author

@findleyr findleyr commented Dec 22, 2020

Another complication here is correctly handling didChangeWatchedFIles notifications when the file change is on disk and the buffer is open and modified. Currently when the event gets to snapshot.clone, we only have the overlay. We need to pass the on-disk file handle as well.

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.