4

How do I disable GoLang's auto-formatting on file save in VSCode?

 2 years ago
source link: https://dev.to/baenencalin/how-do-i-disable-the-golang-s-auto-formatting-on-file-save-in-vscode-1nh
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How do I disable GoLang's auto-formatting on file save in VSCode?

May 13

・1 min read

I'm new to Go, and trying to make something using it, however, each time I press the save button (or use the shortcut Ctrl+S) (so basically, whenever I save the file MANUALLY).

Though, the strange thing is, I have autosave turned on in VSCode, and the file will save after like a second or two, and whenever VSC saves the file, it doesn't get formatted (contrast to when I try to save it myself (as I've just stated)).
There are the GoLang related settings in VSCode's settings.json file:

"go.lintOnSave": "off",
"[go]": {
    "editor.formatOnSave": false,
    "editor.defaultFormatter": null
},
"go.languageServerExperimentalFeatures": {
    "format": false     # Property "format" is not allowed.
}
Enter fullscreen modeExit fullscreen mode

Can someone please tell me what I'm doing wrong? I looked at this and even looked at what Go themselves had to say on their VSCode extension page, but neither of these are helping.

Thanks a lot in advance!
Cheers!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK