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: improve experience when editing a go.mod file by hand #42529

Closed
stamblerre opened this issue Nov 12, 2020 · 3 comments
Closed
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@stamblerre
Copy link
Contributor

Right now, we invalidate metadata on every keystroke, and for a go.mod file, that means that the metadata for the entire workspace is invalidated as you type. This triggers a go list on every keystroke, causing CPU usage to spike. We need to improve the UX of editing a go.mod file by hand, and that likely will be resolved by only invalidating metadata on go.mod saves, not edits.

#42266 might also be helpful, though I don't think it's the critical issue.

@stamblerre stamblerre added this to the gopls/vscode-go milestone Nov 12, 2020
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Nov 12, 2020
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/271299 mentions this issue: internal/lsp/cache: only invalidate metadata for go.mod files on save

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/279033 mentions this issue: gopls/internal/regtest: test metadata validation only on save for go.mod

gopherbot pushed a commit to golang/tools that referenced this issue Dec 17, 2020
There was never a test that actually confirmed that golang/go#42529 was
fixed, so it never actually was.

Updates golang/go#42529

Change-Id: I4264162e98c5fde804c780e098a1d4e21a2d88d8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/279033
Trust: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
@findleyr findleyr self-assigned this Dec 23, 2020
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/279720 mentions this issue: internal/lsp/cache: only reload the workspace on saved changes

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jan 12, 2021
Features

Shadow analyzer

This off-by-default analyzer flags shadowed variables. Learn more
in the Analyzers documentation.

Experimental

New keys for the GC details "annotations" setting

The previous keys were prefixed with "no" and meant to disable
certain GC details checks, which was inconsistent with the style
of our other settings maps. A warning will appear suggesting a
change to the new key name, but the old settings will continue to
work. Full details can be found in the annotations documentation.

Documentation

Improved documentation for available analyzers.

Improved documentation for Vim.

Fixes

Editing the go.mod file by hand (golang/go#42529)

This issue was previously marked as resolved, but it had not actually
been fixed. Package metadata will now only be invalidated when a
go.mod file is saved, so you will need to save before expecting
your changes to be propagated. This should significantly reduce
the number of go list calls (and therefore CPU utilization) as you
edit the go.mod file.
@golang golang locked and limited conversation to collaborators Dec 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants