Using clang-format in CLion

后端 未结 4 2042
天命终不由人
天命终不由人 2020-12-29 01:46

I\'d like to format my code using clang-format in CLion. I\'ve gone through the settings and haven\'t found any setting that would allow me to run an external command to tra

4条回答
  •  春和景丽
    2020-12-29 02:02

    The lates version of CLion 2019.1 has native support for ClangFormat.

    For previous version go to File->Preferences->Plugins and search for ClangFormatIJ. Install this plugin.

    It installs the context menu to invoke locally installed clang-format for a file or for a selection. It also set up the key shortcut for 'Reformat current Statement with clang-format' action.

    This option works quite well for me in CLion 218.3 however, it might be included in an early version as well.

提交回复
热议问题