Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
x/tools/gopls: formatting introducing bad edits #40800
Please answer these questions before submitting your issue. Thanks!
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 I save file, some unexpected text is added.
Steps to reproduce the behavior:
I don't know. This sometimes happens in normal code, and today happened in testing file.
Screenshots or recordings
Thanks for the report - transferred this to the
I am using v0.4.4. I made some log while editing the code by removing that pasted text after saving and saving again, and adding some text and saving again. Hope it will help. For me it is easy to to reproduce this problem. So if you need to test something just name it :)
I suspect the issue is related to line endings somehow. gopls is sending a giant edit for organize imports.
Note that there's one edit per line, plausibly at the end, removing one character from each. We've had problems like this in the past, but I thought we'd fixed them.