go/gopls/doc
Heschi Kreinick 2c115999a7 internal/lsp: use the go command to fix go.mod files
Modifying go.mod files directly leaves go.sum unchanged, and therefore
in need of updates later. Leaving work for the users to clean up isn't
ideal, so it'd be better to use the go command to make modifications.

Unfortunately, the go command has something of a mind of its own. The
most obvious problem is that using go get to add a new require adds a
// indirect comment to that new require, and there's no way to prevent
it. The only thing we can do is add the require first, then use go get
to do nothing but update the go.sum file.

The other inherent problem is that the go command operates on files as
they exist on disk, not the in-memory versions. As discussed, we issue
an error for this case. The alternative would be to work on temporary
files based on the in-memory contents, but that would be much larger
change, so I'd rather not at least right now.

To support Commands for quick fixes, add a new Command field to
source.SuggestedFix, and use it when forming the CodeAction response.

Fixes golang/go#38209.

Change-Id: I0c13ea39199368623e7494e222ba38587323d417
Reviewed-on: https://go-review.googlesource.com/c/tools/+/265981
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-10-28 22:47:54 +00:00
..
acme.md cmd/gopls: add documentation 2019-08-27 15:23:08 +00:00
analyzers.md gopls/doc: fix composites analyzer name 2020-06-12 18:47:36 +00:00
atom.md gopls/doc: add documentation for gopls with Atom 2019-11-27 06:49:51 +00:00
command-line.md gopls/doc: add and make minor changes to documentation 2019-09-16 01:38:12 +00:00
commands.md internal/lsp: use the go command to fix go.mod files 2020-10-28 22:47:54 +00:00
contributing.md gopls/doc: add and make minor changes to documentation 2019-09-16 01:38:12 +00:00
daemon.md internal/lsp/lsprpc: improvements to daemon logging 2020-07-16 19:33:22 +00:00
design.md gopls/doc: update links from godoc.org to pkg.go.dev 2020-10-28 14:18:08 +00:00
emacs.md gopls/doc: remove company-lsp from emacs.md 2020-05-11 23:25:44 +00:00
faq.md cmd/gopls: add documentation 2019-08-27 15:23:08 +00:00
generate.go gopls/doc: use enum value docstrings, if they exist 2020-10-08 18:01:53 +00:00
generate_test.go internal/lsp/source: add additional generated docs 2020-09-28 17:29:33 +00:00
implementation.md internal/lsp, gopls: require a "gopls_" prefix on all commands 2020-10-09 03:22:23 +00:00
integrating.md gopls/doc: update links from godoc.org to pkg.go.dev 2020-10-28 14:18:08 +00:00
settings.md internal/lsp: fix env setting type 2020-10-15 17:44:03 +00:00
status.md gopls/doc: Clear out fixed issues 2020-02-24 23:14:51 +00:00
subl.md cmd/gopls: add documentation 2019-08-27 15:23:08 +00:00
troubleshooting.md gopls/doc: add memory usage info to troubleshooting guide 2020-09-08 20:42:16 +00:00
user.md x/gools/gopls: document settings for working on source distribution 2020-09-10 14:38:07 +00:00
vim.md gopls/doc: update and expand the nvim documentation 2020-09-25 15:01:35 +00:00
vscode.md gopls/doc: update vscode-go GitHub link 2020-06-12 15:25:27 +00:00