-
Notifications
You must be signed in to change notification settings - Fork 2.3k
gopls/internal: CodeAction: quickfix to generate missing method #528
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
Conversation
This PR (HEAD: c6ebf29) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/617619. Important tips:
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
Message from xxx Lulu: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
This PR (HEAD: 498f74b) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/617619. Important tips:
|
This PR (HEAD: 164b097) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/617619. Important tips:
|
e60c303
to
b2156e9
Compare
This PR (HEAD: b2156e9) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/617619. Important tips:
|
This PR (HEAD: 28d6ca0) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/617619. Important tips:
|
This PR (HEAD: 618f3dd) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/617619. Important tips:
|
This PR (HEAD: bd6d7e3) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/617619. Important tips:
|
This PR (HEAD: 4793313) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/617619. Important tips:
|
This PR (HEAD: ad593a7) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/617619. Important tips:
|
Message from Alan Donovan: Patch Set 11: (24 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
Message from xxx Lulu: Patch Set 11: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
Message from Alan Donovan: Patch Set 11: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
This PR (HEAD: 68e660b) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/617619. Important tips:
|
Message from xxx Lulu: Patch Set 12: (24 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
This PR (HEAD: 9fda81b) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/617619. Important tips:
|
Message from xxx Lulu: Patch Set 12: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
This PR (HEAD: 5a3acd9) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/617619. Important tips:
|
Message from Alan Donovan: Patch Set 14: (34 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
Message from xxx Lulu: Patch Set 14: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
2a9e003
to
0bb1109
Compare
This PR (HEAD: 0bb1109) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/617619. Important tips:
|
Message from xxx Lulu: Patch Set 17: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
- postpone param and return type caculation to Emit - add marker test - remove unnecessary test in stub.txt that test local type can not be stubbed
0bb1109
to
537d8c0
Compare
This PR (HEAD: 537d8c0) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/617619. Important tips:
|
This PR (HEAD: 69d0190) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/617619. Important tips:
|
Message from Alan Donovan: Patch Set 19: (35 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
Message from xxx Lulu: Patch Set 19: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
Message from Alan Donovan: Patch Set 19: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
This PR (HEAD: ea695d9) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/617619. Important tips:
|
Message from xxx Lulu: Patch Set 20: (34 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
Message from xxx Lulu: Patch Set 20: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
Message from xxx Lulu: Patch Set 20: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
Message from Alan Donovan: Patch Set 21: (11 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
This PR (HEAD: 7d9f4e0) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/tools/+/617619. Important tips:
|
Message from xxx Lulu: Patch Set 21: (11 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
Message from xxx Lulu: Patch Set 22: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
Message from Alan Donovan: Patch Set 21: Commit-Queue+1 (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
Message from Alan Donovan: Patch Set 22: Code-Review+2 Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
Message from Robert Findley: Patch Set 25: Code-Review+1 Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
Message from Go LUCI: Patch Set 25: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2024-10-14T13:31:33Z","revision":"ca3672d15193947fffdd3e478d3ff178c1bb1df8"} Please don’t reply on this GitHub thread. Visit golang.org/cl/617619. |
This change provides a new "quickfix" code action to repair a function call x.f() with a "type X has no field or method f" error by generating a stub declaration of the missing method. - extract common functionality about adjusting import, generating diffs to a shared function. - add new stubMissingCalledFunctionFixer (for missing method calls), change stubMethodsFixer to stubMissingInterfaceMethodsFixer (for interfaces) to make it not vague about which kind of stub it actually be. - algos to get type info: for arguments, get type directly, for return values, currently only implement inferring from variable assignment and parameter assignment. - remove a test in stub.txt that tests local types can't be stubbed, after this CL, this check has been moved to GetCallStubInfo and GetIfaceStubInfo, thus gopls will not offer a bad fix. There is a detailed test that demonstrated this pr. Fixes golang/go#69692 Change-Id: Ia7aecdaf895da2a9a33b706f26b7766e4d42c8a1 GitHub-Last-Rev: 7d9f4e0 GitHub-Pull-Request: #528 Reviewed-on: https://go-review.googlesource.com/c/tools/+/617619 Reviewed-by: Robert Findley <[email protected]> Reviewed-by: Alan Donovan <[email protected]> Auto-Submit: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Commit-Queue: Alan Donovan <[email protected]>
This PR is being closed because golang.org/cl/617619 has been merged. |
This change provides a new "quickfix" code action to repair a
function call x.f() with a "type X has no field or method f" error
by generating a stub declaration of the missing method.
generating diffs to a shared function.
change stubMethodsFixer to stubMissingInterfaceMethodsFixer
(for interfaces) to make it not vague about which kind of stub
it actually be.
for return values, currently only implement inferring from variable
assignment and parameter assignment.
after this CL, this check has been moved to GetCallStubInfo
and GetIfaceStubInfo, thus gopls will not offer a bad fix.
There is a detailed test that demonstrated this pr.
Fixes golang/go#69692