Releases: golang/tools
gopls/v0.5.3
gopls/v0.5.3
Features
Automatic updates to go.sum
Previously, go.mod
-related quick fixes would not make corresponding changes to your go.sum
file. Now, when you add or remove dependencies from your module, your go.sum
will be updated accordingly.
Removed support for go mod tidy
on save
We have removed the support for running go mod tidy
on save for go.mod
files. It proved to be too slow and expensive to be worth it.
Experimental
Multi-module workspace support
The proposal described in golang/go#32394 is still in development and off by default. See our progress by tracking the multi-module workspace milestone and project.
Enable multi-module workspace support by adding the following to your settings:
"gopls": {
"experimentalWorkspaceModule": true,
}
With this setting, you will be able to open a directory that contains multiple modules. Most features will work across modules, but some, such as goimports
, will not work as expected.
Give this a try if you're interested in this new feature, but please note that it is still very experimental.
Fixes
A list of all issues fixed can be found in the gopls/v0.5.3 milestone.
Thank you to our contributors!
gopls/v0.5.2
gopls/v0.5.2
Features
No new features have been added in this release.
Experimental
We have added support for a new allExperiments
setting. By enabling this flag, you will enable all experimental features that we intend to roll out slowly. You can still disable individual settings (full list of settings). In-progress features, such as multi-module workspaces (below), will remain disabled until they are ready for users.
Improved CPU utilization: experimentalDiagnosticsDelay
experimentalDiagnosticsDelay
controls the amount of time that gopls waits after the most recent file modification before computing deep diagnostics. Simple diagnostics (parsing and type-checking) are always run immediately on recently modified packages.
Enable it by setting it to a duration string, for example "200ms"
. With allExperiments
, this is set to "200ms"
.
Improved memory usage for workspaces with multiple folders: experimentalPackageCacheKey
experimentalPackageCacheKey
controls whether to use a coarser cache key for package type information. If you use the gopls daemon, this may reduce your total memory usage.
Enable it by setting it to true
. With allExperiments
, this is set to true
.
Multi-module workspace support
The proposal described in golang/go#32394 is still in development and off by default. See our progress by tracking the multi-module workspace milestone and project.
Enable multi-module workspace support by adding the following to your settings:
"gopls": {
"experimentalWorkspaceModule": true,
}
With this setting, you will be able to open a directory that contains multiple modules. Most features will work across modules, but some, such as goimports
, will not work as expected.
Give this a try if you're interested in this new feature, but please note that it is still very experimental.
Support for semantic tokens
This is a new, unreleased LSP feature that provides additional syntax highlighting. In advance of this new LSP version, we have added preliminary support for this feature. Enable it by setting:
"gopls": {
"semanticTokens": true,
}
It will not be enabled with allExperiments
.
Fixes
A list of all issues fixed can be found in the gopls/v0.5.2 milestone.
For editor clients
All command names have been given gopls.
prefixes, to avoid conflicting with commands registered by other language servers.
This should not have affected any clients.
Thank you to our contributors!
@heschik @findleyr @dandua98 @pjweinb @leitzler @kortschak @bcmills @hyangah @jadekler
gopls/v0.5.1
gopls/v0.5.1
Features
Completion speed improvements
https://golang.org/cl/257240 eliminated some duplicate type-checking in completions (and some other features), halving latency in most cases.
Improvements to symbol rankings
From https://golang.org/cl/254037:
Downrank symbols if they are:
- Unexported and outside of the workspace. Since one wouldn't jump to these symbols to e.g. view documentation, they are less relevant.
- Fields and interface methods. Usually one would jump to the type name, so having fields highly ranked can be noisy.
Warnings for excluded files
You will now see diagnostics if you open a file that is excluded from the current build, likely by build tags. This should aid in understanding cases when gopls
fails to work on a certain file.
Better error reporting when code lenses fail
A pop-up with an error will appear if a code lens fails to run its command.
Experimental
Multi-module workspace support
The proposal described in golang/go#32394 is partially implemented, but off by default.
Enable multi-module workspace support by adding the following to your settings:
"gopls": {
"experimentalWorkspaceModule": true,
}
With this setting, you will be able to open a directory that contains multiple modules. Most features will work across modules, but some, such as go mod tidy
diagnostics, are not yet implemented.
Give this a try if you're interested in this new feature, but please note that it is still very experimental.
Fixes
Toggle GC Details
on Windows
There was a bug in the new experimental GC details code lens on Windows machines (golang/go#41614). We added a work-around to fix the issue.
A list of all issues fixed can be found in the gopls/v0.5.1 milestone.
Documentation
The documentation for settings is now automatically generated so it will stay up-to-date. Documentation was also updated for working with Neovim and for working on the Go project itself.
Thank you to our contributors!
gopls/v0.5.0
A full list of issues closed can be found in the gopls/v0.5.0 milestone.
Memory usage
- Rewrite of caching model, resulting in significant memory usage improvements (@heschik).
New features
- Extract to function: Support for extracting code blocks that contain return statements (@joshbaum).
- Workspace symbols: Support for fzf-style search syntax (@findleyr). The following syntax is supported:
'
for exact matching^
for prefix matching$
for suffix matching
Note: This feature does not yet work in VS Code. See golang/vscode-go#647 and microsoft/vscode#106788.
- An experimental new code lens to view GC optimization details (@pjweinb). Once the code lens is enabled, you will see a
Toggle gc details
annotation at the top of your file. Clicking it will show optimization diagnostics produced by the Go compiler, and clicking it once again will hide these diagnostics. Enable the code lens by adding the following to your settings:"codelens": { "gc_details": true }
go mod tidy
andgo mod vendor
code lenses forgo.mod
files (@dandua98).- Support for filling in matching in-scope variables instead of just empty values in fillstruct and fillreturns (@joshbaum).
- Autocompletion within import statements (@dandua98).
- Autocompletion within package declarations (@dandua98).
Improvements
- Improvements to workspace symbols ranking and fuzzy matching (@findleyr, @myitcv).
- Better completion suggestions in type switch case clauses and for calls to
append
, function literals, and unnamed types (@muirdm).
Thank you
Thank you to everyone who contributed to this release!
@heschik
@findleyr
@pjweinb
@joshbaum
@mcjcloud
@dandua98
@muirdm
@leitzler
@myitcv
@matloob
@tennashi
@ainar-g
@hasheddan
gopls/v0.4.4
- Support for opening a single file. Previously,
gopls
required you to open an entire directory. - Support features and diagnostics for the entire module, even when you open a subdirectory of the module.
- Extract a selected range to a variable or to a function. This feature is still relatively new, so please report issues if you encounter any. (@joshbaum)
- Fillstruct performance improvements. It is now enabled by default again. (@joshbaum)
- Improvements in go.mod diagnostic error presentation.
A full list of all issues closed is available in the gopls/v0.4.4 milestone.
gopls/v0.4.3
Disable the fillstruct
analysis by default.
We recently uncovered some performance issues with the analysis, leading us to disable it by default.
Once those issues are resolved, we will enable it by default again.
You can still enable it by adding the following to your VS Code settings:
"gopls": {
"analyses": {
"fillstruct": true,
}
}
gopls/v0.4.2
- Significant memory improvements (@heschik). Dependency test variants and vendored packages are no longer considered "workspace packages".
- Smart autocompletion for "append" (@muirdm).
- A "fill struct" code action to suggest populating a struct literal with default values (@luciolas, @joshbaum).
- Better cgo support with Go 1.15 (@heschik). Learn more: golang/go#35721 (comment).
- Code lens to run Go tests directly in the editor (@martskins). Currently opt-in:
"gopls": {
"codelens": {
"test": true,
}
}
- Improved folding in composite literals (@joshbaum).
- Pop-up suggestion to run
go mod vendor
when inconsistent vendoring detected (@stamblerre). - Respect
GOPRIVATE
for all document links and links on hover (@findleyr). - A full list of issues resolved in this release can be found in the gopls/v0.4.2 milestone.
gopls/dev.go2go: You can use the new go2go prototype with gopls. See golang/go#39619.
gopls/v0.4.1
This release contains mostly stability improvements and smaller bug fixes. A list of all of the issues fixed in this release can be found in the gopls/v0.4.1 milestone. A notable change is that type error analyzers (fillreturns, undeclaredname, unusedparams, nonewvars) are now on by default.
gopls/v0.4.0
- Improved support for working with modules (@ridersofrohan). A detailed walk-through of the new features can be found here. A quick summary:
- Use the
-modfile
flag to suggest which modules should be added/removed from thego.mod
file, rather than editing it automatically. - Suggest dependency upgrades in-editor and provide additional language features, such as formatting, for the
go.mod
file.
- Use the
- Inverse implementations (@muirdm). "Go to implementations" on a concrete type will show the interfaces it implements.
- Completion improvements (@muirdm). Specifically, improved completion for keywords. Also, offer
if err != nil { return err }
as a completion item. - Jumping to definition on an import statement returns all files as definition locations (@danishprakash).
- Support for running
go generate
through the editor, via a code lens (@marwan-at-work). - Command-line support for workspace symbols (@daisuzu).
Opt-in:
- Code actions suggesting
gofmt -s
-style simplifications (@ridersofrohan). To get these on-save, add the following setting:
"[go]": {
"editor.codeActionsOnSave": {
"source.fixAll": true,
}
}
- Code actions suggesting fixes for type errors, such as missing return values (goreturns-style), undeclared names, unused parameters, and assignment statements that should be converted from
:=
to=
(@ridersofrohan). Add the following to your gopls settings to opt-in to these analyzers. In the future, they will be on by default and high-confidence suggested fixes may be applied on save. See additional documentation on analyzers here.
"gopls": {
"analyses": {
"fillreturns": true,
"undeclaredname": true,
"unusedparams": true,
"nonewvars": true,
}
}
- Further improvements in the support for multiple concurrent clients (@findleyr). See #34111 for all details.
For a complete list of the issues resolved, see the gopls/v0.4.0 milestone.
gopls/v0.3.4
- golang.org/cl/222979: fix for a nil pointer exception in completion (@muirdm).
- golang.org/cl/222980: fix a concurrent map write and iteration (@ridersofrohan).