1. 搜索扩展Astyle并安装
  2. 下载Astyle:https://sourceforge.net/projects/astyle/files/,解压缩后添加Astyle.exe的路径到系统环境变量,例如我在Path中增加一条D:\vscode\AStyle_3.1_windows\AStyle\bin
  3. 重启vscode使环境变量生效
  4. 可修改astyle的配置:例如我在用户设置中增加字段
    "astyle.additional_languages": [
        "c",
        "cpp",
    ],
    "astyle.cmd_options": [
        "--style=kr",//Kernighan&Ritchie 风格格式和缩进
        "--indent=spaces=4",//缩进4个空格
        "--convert-tabs",
        "--align-pointer=name",
        "--align-reference=name",
        "--keep-one-line-statements",
        "--pad-header",
        "--pad-oper",//操作符两端插入一个空格
    ],
  1. 对C/C++源文件使用alt+shift+f测试格式重排

相关文章:

  • 2021-10-28
  • 2021-12-26
  • 2022-01-29
  • 2021-07-29
  • 2022-12-23
  • 2021-10-09
  • 2022-02-09
  • 2022-12-23
猜你喜欢
  • 2021-10-10
  • 2022-12-23
  • 2022-12-23
  • 2021-08-10
  • 2021-09-02
  • 2021-09-26
  • 2021-11-04
相关资源
相似解决方案