美文网首页
vscode C++ 开发配置 google code styl

vscode C++ 开发配置 google code styl

作者: 荷茗 | 来源:发表于2019-04-08 11:44 被阅读0次

    vscode C++ 开发配置 google code style

    代码格式插件

    1. ⌘ +⇧+p 输入 install extensions,选择安装C/C++ for Visual Studio Code
    2. brew install clang-format
    3. brew info clang-format 找到 clang-format的路径。
    4. ⌘ +⇧+p 输入 Open Settings (JSON)

    加入

    "C_Cpp.clang_format_fallbackStyle":
     "{ BasedOnStyle: Google, IndentWidth: 2, ColumnLimit: 0}",
     
    "C_Cpp.clang_format_path": 
    "/usr/local/Cellar/clang-format/2018-12-18/bin/clang-format"
    

    保存,然后⌘ +⇧+p 输入 Reload Window 这样就可以了。

    1. ⌘ +⇧+p 输入 open keyboard shortcuts 绑定format的快捷键。

    CPPLint

    cpplint 是 goole 家开发的用来检查c++代码的风格的代码。

    sudo pip install cpplint

    注意这里是 sudo 要不然权限不对。

    pip show cpplint 找到路径

    一般来说是/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages 有可能python的版本不一样。

    ⌘ +⇧+p 输入 Open Settings (JSON)

    输入

    "cpplint.cpplintPath": 
    "/Library/Frameworks/Python.framework/Versions/3.6
    /lib/python3.6/site-packages/cpplint.py"
    

    注意要加上 `cpplint.py

    相关文章

      网友评论

          本文标题:vscode C++ 开发配置 google code styl

          本文链接:https://www.haomeiwen.com/subject/kkduiqtx.html