visual-studio-codeastylecppfront

Astyle format a cpp2 file automatically in VS Code?


Using Astyle extension with VS Code. I can format a cpp2 file with Ctrl+Shift+I.

How can I have the formatting happen automatically at other times such as a text paste or file save?

Installed:


Solution

  • According to User and Workspace Settings in settings.json add:

    "[cpp2]": {
        "editor.defaultFormatter": "chiehyu.vscode-astyle",
        "editor.formatOnSave": true,
    },
    

    which applies the formatting when the file is saved.