-
Notifications
You must be signed in to change notification settings - Fork 11
VSCodeでclang formatの設定
Tatsumi Nishida edited this page Jun 10, 2019
·
11 revisions
まず以下のサイトからプラグインをインストール.
https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools
インストール方法は↓の画像を参照.
![スクリーンショット 2019-06-05 0 48 52](https://user-images.githubusercontent.com/19218690/58894180-79021080-872c-11e9-8332-8e36db6826f1.png)
Dropboxからclang-formatファイルをダウンロード.(Slackチャンネルにclang-formatファイルがあるDropboxのURLはあります)
VSCodeでsettings.json
を開き,以下を追加.
// 指定したファイルのフォーマットに従って整形
"C_Cpp.clang_format_style": "file",
// 保存時に自動整形
"editor.formatOnSave": true,
// エディタで区切りを入力後に自動でフォーマットをするかどうか
"editor.formatOnType": true
これで保存時に自動整形してくれるはずです.(Command + sで保存)
整形しない場合は,VSCodeを再起動してください.
この設定は,プロジェクト内の.clang-formatファイルにしたがって整形します.
C/C++ for Visual Studio Code (Preview)