x/tools/gopls: "Extract Method" leaves comments behind #50851
What version of Go, VS Code & VS Code Go extension are you using?
Share the Go related settings you have added/edited
Describe the bug
When you select a block of code that has comments in it, and choose the "Extract Method" command, it extracts the statements from that block into a new method, but it leaves the comments in the original location. This is unhelpful because the comments are explaining particular operations in the code that was extracted, and they are now distanced from the statements they explain. What it should do is extract the entire block of code including its comments.
Steps to reproduce the behavior:
What I see as a result is:
The comment was left in func1, when it should have stayed above the println("c") in newMethod.
The text was updated successfully, but these errors were encountered:
Thanks, @ShoshinNikita, for giving references to suggest that this problem is already known. However, the distinction between bug and limitation is pointless: either way, it is code that does not do what users reasonably expect it to do. At minimum it seems worth having this issue open to track the issue until it can be corrected.