Extract Function
Refactoring Does Not Work When Comments are Present
#2437
Labels
FrozenDueToAge
gopls
gopls related issues
upstream-tools
Issues that are caused by problems in the tools that the extension depends on.
Milestone
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
go version
to get version of Go from the VS Code integrated terminal.gopls -v version
to get version of Gopls from the VS Code integrated terminal.code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.Go: Locate Configured Go Tools
command.Share the Go related settings you have added/edited
Run
Preferences: Open Settings (JSON)
command to open your settings.json file.Share all the settings with the
go.
or["go"]
orgopls
prefixes.Describe the bug
Extract Function works as expected when Comments are not present in the code.
However, Extract Function does not work when Comments are present in the code. You simply get the "No refactorings available" message.
Steps to reproduce the behavior:
The below code is inside a larger function. They cannot be extracted to another function (via the Extract Function refactoring) because of the Comments.
Make sure to include the comments when you highlight all the code in each snippet:
Snippet 1:
Snippet 2:
Snippet 3:
Screenshots or recordings
The above code can be pasted inside any function (e.g. the
main
function).You will not be able to extract them to another function because of the comments.
The text was updated successfully, but these errors were encountered: