vscode-zig icon indicating copy to clipboard operation
vscode-zig copied to clipboard

does not respect `"editor.formatOnSave": false`

Open scheibo opened this issue 2 years ago • 5 comments

I am finding the format on save functionality to be quite slow when editing 10k line files on my 2019 x86 macbook (#63) and would like to turn off auto formatting on save and go back to just having a keybinding which triggers formatting, but can't seem to figure out how to do so. My settings.json includes "editor.formatOnSave": false but the Zig plugin seems to disregard this.

scheibo avatar Mar 26 '23 03:03 scheibo

I'm not sure how editor.formatOnSave is supposed to work since we don't touch it in the extension but setting it specifically for Zig does work:

    "[zig]": {
        "editor.defaultFormatter": "ziglang.vscode-zig",
        "editor.formatOnSave": false
    },

Vexu avatar Mar 26 '23 12:03 Vexu

editor.formatOnSave works

wenq1 avatar Mar 26 '23 14:03 wenq1

I'm not sure how editor.formatOnSave is supposed to work since we don't touch it in the extension but setting it specifically for Zig does work:

    "[zig]": {
        "editor.defaultFormatter": "ziglang.vscode-zig",
        "editor.formatOnSave": false
    },

Yup, this works, thanks! "editor.formatOnSave": false at the top level did not, so perhaps I was just misunderstanding how it was meant to be used. Thanks!

scheibo avatar Mar 26 '23 15:03 scheibo

I will have to necro this issue: While I am aware that I'd need to disable format-on-save for zig specifically, but I disagree with keeping this as the solution and never looking into the issue.

I would like to disable format-on-save globally and enable it on a per project basis, ideally without having to manually open a json file (because as far as I'm aware, you can't just change settings on a per language basis in the graphical interface).
For one, it is additional lines to add in the json, it is added friction, and it is counter intuitive.

I suggest you reopen the issue, and actually look into it. Because I'm quite sure that I am not the only one bothered by this, and I'd argue that changing the setting for zig specifically feels hackier than having the Zig extension work properly as it should.

TotoShampoin avatar Jul 17 '25 16:07 TotoShampoin

I looked at extensions for other languages and Go's was the only other one to default editor.formatOnSave to true but it is also the only other one to have an opinionated formatter like Zig. I also set the option to false so it might be more popular to change the default.

Vexu avatar Jul 19 '25 10:07 Vexu