Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>c语言插件集New to Visual Studio Code? Get it now.
c语言插件集

c语言插件集

brand

|
5,222 installs
| (0) | Free
c语言代码的插件工具集
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

c语言插件集

astyle

  1. 首先下载astyle https://sourceforge.net/projects/astyle
  2. 按下ctrl+,打开vscode在设置界面搜索setting,点击在setting.json中编辑
  3. 添加如下字段,其中astyle.executable字段根据自己的astyle的路径填写
    "astyle.cmd_options": [
        "--style=allman", //
        "--indent=spaces=4", //缩进4个空格
        "--convert-tabs",
        "--align-pointer=name",
        "--align-reference=name",
        "--keep-one-line-statements",
        "--pad-header",
        "--pad-oper", //操作符两端插入一个空格
        "--indent-switches",
        "--indent-namespaces",
        "--indent-continuation=4",
        "--indent-preproc-block",
        "--indent-preproc-define",
        "--indent-preproc-cond",
        "--indent-col1-comments",
        "--unpad-paren",
        "--delete-empty-lines",
        "-Y",
        "-j",
        "--pad-comma"
    ],
    "astyle.executable": "G:\\AStyle\\bin\\Astyle.exe",
    "[c]": {
        "editor.defaultFormatter": "chiehyu.vscode-astyle"
    },
    "astyle.csharp.enable": true,
    "astyle.additional_languages": [
        "c",
        "cpp",
    ],
    "C_Cpp.formatting": "Disabled",
    "[cpp]": {
        "editor.defaultFormatter": "chiehyu.vscode-astyle"
    },
    
  4. 打开代码按下ctrl+shift+f格式化代码,格式化配置为字段astyle.cmd_options下的配置
  5. 效果对比
    avatar
    avatar

c-define-align

宏定义对齐插件,选择需要对齐的宏定义,按下ctrl+=或右键->align define对齐宏定义,效果如下
avatar
avatar

better-align

一个根据: = += -= *= /= =>来进行对齐的插件

  1. 按住ctrl然后先按k再按s打开键盘快捷方式
  2. 搜索wwm.aligncode,根据自己喜好绑定对应键值

效果对比
avatar
avatar

better-comments

对于不同注释使用不同颜色区分

bracket-pair-colorizer

对同级的括号用相同的颜色标识

change-case

更改变量命名方式,可以改为全部大写,全部小写,下划线方式,驼峰命名等等

  1. 选中变量名
  2. 按下F1
  3. 输入change case选择命名方式

vscode-smart-column-indenter

自动文本对齐的插件,对于一些文本进行对齐,由于插件原来用于*.ts, *.js *.json 因此在对齐c语言代码时可能出现一些问题

  1. 选中需要对齐的代码
  2. 右键选择Indent into N Columns Indent into 2 Columns Remove Line Breaks来选择对齐操作
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft