-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gopls/internal/codeaction: replace all occurrences of expression (refactor.extract.variable.all) #539
Conversation
This PR (HEAD: 4e59087) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/624035. Important tips:
|
This PR (HEAD: 00f4d8a) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/624035. Important tips:
|
This PR (HEAD: 2eeb2c4) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/624035. Important tips:
|
This PR (HEAD: 0c4ddaf) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/624035. Important tips:
|
This PR (HEAD: 2f839f4) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/624035. Important tips:
|
This PR (HEAD: 78461fc) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/624035. Important tips:
|
30abec2
to
0324b69
Compare
This PR (HEAD: 0324b69) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/624035. Important tips:
|
37c7b7b
to
83f4dc3
Compare
This PR (HEAD: 83f4dc3) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/624035. Important tips:
|
This PR (HEAD: 8581970) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/624035. Important tips:
|
This PR (HEAD: 51938d2) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/624035. Important tips:
|
This PR (HEAD: f935517) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/624035. Important tips:
|
This PR (HEAD: 26fbd88) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/624035. Important tips:
|
Message from xxx Lulu: Patch Set 56: (3 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/624035. |
Message from Alan Donovan: Patch Set 57: Code-Review+2 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/624035. |
330446e
to
a02dc30
Compare
This PR (HEAD: a02dc30) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/624035. Important tips:
|
Message from xxx Lulu: Patch Set 57: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/624035. |
Message from Alan Donovan: Patch Set 58: Code-Review+1 (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/624035. |
Message from Alan Donovan: Patch Set 58: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/624035. |
This PR (HEAD: d614fb5) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/624035. Important tips:
|
34d0e27
to
e22276d
Compare
Message from xxx Lulu: Patch Set 58: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/624035. |
This PR (HEAD: e22276d) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/624035. Important tips:
|
Message from xxx Lulu: Patch Set 59: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/624035. |
Message from Alan Donovan: Patch Set 59: Code-Review+2 Copied votes on follow-up patch sets have been updated:
(2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/624035. |
new test zz reflect diable in lhs
This PR (HEAD: b66a18d) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/624035. Important tips:
|
Message from Robert Findley: Patch Set 61: Code-Review+1 Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/624035. |
Message from Go LUCI: Patch Set 61: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2024-12-18T19:48:35Z","revision":"c31577540d532468c235fc0329994c862f35f47b"} Please don’t reply on this GitHub thread. Visit golang.org/cl/624035. |
Message from Robert Findley: Patch Set 61: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/624035. |
…actor.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#70085 Fixes golang/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]>
Message from Robert Findley: Patch Set 61: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/624035. |
Message from Go LUCI: Patch Set 61: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/624035. |
Message from Go LUCI: Patch Set 61: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/624035. |
This PR is being closed because golang.org/cl/624035 has been merged. |
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:
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.
extract_expressions_resolve.txt.
Updates golang/go#70085
Fixes golang/go#70563