vscode添加Astyle


1、安裝astyle插件,在應用商城里面一鍵安裝即可。
2、下載astyle的bin文件,並添加到系統環境變量。
3、打開vscode的settings.json,添加以下代碼。

 

{
    "editor.mouseWheelZoom": true,    //鼠標放大的

    "astyle.additional_languages": [
        "c",
        "cpp",
    ],

    "astyle.cmd_options": [
        "--style=allman",//Kernighan&Ritchie 風格格式和縮進
        "--indent=spaces=4",//縮進4個空格
        "--convert-tabs",
        "--align-pointer=name",
        "--align-reference=name",
        "--keep-one-line-statements",
        "--pad-header",
        "--pad-oper",//操作符兩端插入一個空格
    ],

    "astyle.executable": "D:\\AStyle\\bin\\astyle.exe",

    "files.encoding":"GB2312",//文件編碼的,以防中文亂碼

    "[c]": {
        "editor.defaultFormatter": "chiehyu.vscode-astyle"
    },  //這個是插件安裝好了就有的
}

 

  

注意要添加逗號

然后在文件中使用Alt+Shift+F就可以格式化代碼啦。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM