You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
Say I change main to foo and hit save. I'm using goimports to format; when save runs the formatter, nothing is changed because my code is already formatted correctly. However, VSCode-Go still seems to replace the entire document, which means that if I hit cmd-Z, nothing happens. I have to hit cmd-Z once more in order to undo my change.
VSCode-Go should realize that the newly formatted file is the same as the current file, and do nothing.
To be honest, I'd prefer if formatOnSave did not count as part of the undo stack. I'd prefer "save + undo" to undo the format and my last edit, which is a lot more rational; they do belong together, and I'd argue there's absolutely utility to undoing only the formatting but not your own edit. However, I don't know if VSCode offers the necessary plumbing to group undo operations like this. I noticed a very similar problem with the Autotrim extension.
For example, a simple Go file:
Say I change
maintofooand hit save. I'm usinggoimportsto format; when save runs the formatter, nothing is changed because my code is already formatted correctly. However, VSCode-Go still seems to replace the entire document, which means that if I hitcmd-Z, nothing happens. I have to hitcmd-Zonce more in order to undo my change.VSCode-Go should realize that the newly formatted file is the same as the current file, and do nothing.
To be honest, I'd prefer if
formatOnSavedid not count as part of the undo stack. I'd prefer "save + undo" to undo the format and my last edit, which is a lot more rational; they do belong together, and I'd argue there's absolutely utility to undoing only the formatting but not your own edit. However, I don't know if VSCode offers the necessary plumbing to group undo operations like this. I noticed a very similar problem with the Autotrim extension.