Formatting a Go document mangles and breaks code. #2969
Comments
What is the output of |
@Borkason Can you please provide the details @stamblerre is asking above? |
I encountered the same problem. gopls version:
but by It's just a black windows there at Debug Console. this is my user settings.json:
|
@darjun: You can also try Ctrl + Shift + P -> "View: Toggle Output", and then there should be a drop-down menu that says "Tasks" in the right-hand top corner. When you click on it, "gopls" should be in this list. Click on that, and then the log should be there. You will also need to add the following to your settings to get more detailed logging: "go.languageServerFlags": [
"-rpc.trace"
] |
There is also more information on the Go issue tracker (golang/go#34955), so please follow-up there, if possible. |
I put gopls log at gist, this is the link https://gist.github.com/darjun/447159f76166f2d45684da406e646f1c |
@darjun: Would you be able to provide a smaller log with a repro and the other details requested on golang/go#34955 (feel free to just add a comment to that issue)? The log you've provided seems to be truncated and for a larger project, so it's difficult to parse. Thanks! |
I have the same problem. For reproduce clone repo, open folder in visual studio code, open main.go and save it |
@LordNeznay: Do you have the same issue with |
@stamblerre, after |
Glad to hear it! Thanks for following up. |
@Borkason, @darjun: If you get a chance, please try out |
Thanks @stamblerre Since the next version
|
What version of Go, VS Code & VS Code Go extension are you using?
go version
to get version of Gocode -v
orcode-insiders -v
to get version of VS Code or VS Code Insidersgo env GOOS GOARCH
to get the operating system and processor arhcitecture detailsShare the Go related settings you have added/edited
Describe the bug
When formatting the document, code gets mangled and broken.
Happens also when saving.
Steps to reproduce the behavior:
Happens when formatting the document (ALT-SHIFT-F).
Sometimes also when saving the document.
I can't always reproduce this.
Screenshots or recordings
It also breaks the import statement
The text was updated successfully, but these errors were encountered: