mirror of
https://github.com/golang/go
synced 2024-11-05 14:46:11 -07:00
9267083701
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> |
||
---|---|---|
.. | ||
testdata/src/a | ||
undeclared_test.go | ||
undeclared.go |