go/internal/lsp/source
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
..
completion internal/lsp: clean up unused parameters 2020-10-16 23:51:31 +00:00
genapijson internal/lsp/source: use 'gopls.' instead of 'gopls_' 2020-10-20 14:19:29 +00:00
api_json.go internal/lsp: use the go command to fix go.mod files 2020-10-28 22:47:54 +00:00
call_hierarchy.go internal/lsp/source: handle a possible nil pointer in call hierarchy 2020-10-09 16:22:40 +00:00
code_lens.go gopls: add "go test" code action 2020-10-13 16:52:01 +00:00
command.go internal/lsp: use the go command to fix go.mod files 2020-10-28 22:47:54 +00:00
comment.go internal/lsp/source: use space character in markdown formatting 2020-08-26 03:44:07 +00:00
comment_test.go
diagnostics.go internal/lsp: use the go command to fix go.mod files 2020-10-28 22:47:54 +00:00
extract.go internal/lsp: clean up unused parameters 2020-10-16 23:51:31 +00:00
folding_range.go internal/lsp/source: move completion to its own package 2020-09-08 19:19:08 +00:00
format.go internal/lsp: clean up unused parameters 2020-10-16 23:51:31 +00:00
format_test.go internal/lsp: reproduce and fix golang/go#41057 2020-09-02 22:40:51 +00:00
gc_annotations.go internal/lsp: unify go command invocation logic 2020-10-28 22:19:10 +00:00
highlight.go internal/lsp/source: move completion to its own package 2020-09-08 19:19:08 +00:00
hover.go internal/lsp: clean up unused parameters 2020-10-16 23:51:31 +00:00
identifier.go internal/lsp: fix hover for builtin error method (Error) 2020-10-05 18:50:03 +00:00
identifier_test.go internal/lsp/source: add a unit test for searchForEnclosing 2020-07-28 18:51:24 +00:00
implementation.go internal/lsp/source: move completion to its own package 2020-09-08 19:19:08 +00:00
options.go internal/lsp: update lsp protocol stubs to match LSP 3.16 revisions 2020-10-27 18:00:23 +00:00
options_test.go internal/lsp: don't show an error for "allExperiments" in (options).set 2020-10-07 03:26:33 +00:00
references.go internal/lsp/source: show references to interface methods 2020-10-06 22:15:05 +00:00
rename.go internal/lsp/source: show references to interface methods 2020-10-06 22:15:05 +00:00
rename_check.go internal/lsp/source: handle nil pointer in rename_check.go 2020-10-23 17:41:41 +00:00
signature_help.go internal/lsp: clean up unused parameters 2020-10-16 23:51:31 +00:00
source_test.go internal/lsp: add gopls semtok command and semantic token tests 2020-10-16 18:10:36 +00:00
symbols.go internal/lsp: don't show blank identifiers in outline 2020-10-09 01:09:51 +00:00
types_format.go internal/lsp: clean up unused parameters 2020-10-16 23:51:31 +00:00
util.go internal/lsp: move package selection to before type checking 2020-09-24 22:42:22 +00:00
view.go internal/lsp: use the go command to fix go.mod files 2020-10-28 22:47:54 +00:00
workspace_symbol.go internal/lsp/source: tweak the WorkspaceSymbols docstring 2020-10-28 22:16:44 +00:00
workspace_symbol_test.go internal/lsp/source: support some fzf-like tokens in symbol matching 2020-09-08 16:35:05 +00:00