1
0
mirror of https://github.com/golang/go synced 2024-11-18 12:34:42 -07:00
go/internal/lsp/tests
Rebecca Stambler 9267083701 internal/lsp: support refactor.extract through commands
The logic for extracting a function is quite signficant, and the code
is expensive enough that we should only call it when requested by the
user. This means that we should support extracting through a command
rather than text edits in the code action.

To that end, we create a new struct for commands. Features like extract
variable and extract function can supply functions to determine if they
are relevant to the given range, and if so, to generate their text
edits. source.Analyzers now point to Commands, rather than
SuggestedFixFuncs. The "canExtractVariable" and "canExtractFunction"
functions still need improvements, but I think that can be done in a
follow-up.

Change-Id: I9ec894c5abdbb28505a0f84ad7c76aa50977827a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/244598
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-07-27 19:25:51 +00:00
..
tests_go115.go internal/lsp: use TypecheckCgo when possible 2020-05-13 17:53:51 +00:00
tests.go internal/lsp: support refactor.extract through commands 2020-07-27 19:25:51 +00:00
util.go internal/lsp: check if analysis enabled in convenience fixes 2020-07-08 18:02:25 +00:00