You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gopls/internal/codeaction: replace all occurrences of expression (refactor.extract.variable.all)
This change introduces a new refactoring code action
"Extract n occurrences of expression".
The original "Extract Variable" is treated as a limited version
of "Extract n occurrences of expression", they share the same
underlying implementation. The difference is that
"extract_all" utilizes a slice of structural equal expression
by searching through the entire function body, while the limited
version simply append the expression under selection to that slice.
Also:
- change default variable name from "x" to "newVar",
default const name from "k" to "newConst",
users will almost always perform a rename after
extraction, so this change make it more discoverable,
especially when there are multiple matches.
- add marker test extract_expressions.txt and
extract_expressions_resolve.txt.
Updates golang/go#70085Fixesgolang/go#70563
Change-Id: I767b82be8a60d39c7aff087197c65d435b138826
GitHub-Last-Rev: b66a18d
GitHub-Pull-Request: #539
Reviewed-on: https://go-review.googlesource.com/c/tools/+/624035
Reviewed-by: Alan Donovan <[email protected]>
Reviewed-by: Robert Findley <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
0 commit comments