github golang/tools gopls/v0.4.0

latest releases: gopls/v0.15.3, gopls/v0.15.3-pre.2, gopls/v0.15.3-pre.1...
3 years ago
  • 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 the go.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.
  • 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.

Don't miss a new tools release

NewReleases is sending notifications on new releases.