-
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
インストール方法は↓の画像を参照.

Dropboxからclang-formatファイルをダウンロード.(Slackチャンネルにclang-formatファイルがあるDropboxのURLはあります)
VSCodeでsettings.json
を開き,以下を追加.
// ワークスペース内の.clang-formatファイルを探してそのスタイルを適用する.存在しない場合,C_Cpp.clang_format_fallbackStyleの設定が適用される.
"C_Cpp.clang_format_style": "file",
// 保存時に自動整形
"editor.formatOnSave": true
これで保存時に自動整形してくれるはずです.(Command + sで保存)
整形しない場合は,VSCodeを再起動してください.
この設定は,プロジェクト内の.clang-formatファイルにしたがって整形します.