apt install clang-format
which clang-format // 여기서 나오는 clang-format 실행파일 경로 확인
https://marketplace.visualstudio.com/items?itemName=xaver.clang-format
// .vscode/settings.json
{
"clang-format.executable": "/usr/bin/clang-format",
"editor.formatOnSave": true
}
// .clang-format
BasedOnStyle: Google
IndentWidth: 4
UseTab: Never
ColumnLimit: 120
AllowShortFunctionsOnASingleLine: Empty
BreakBeforeBraces: Allman
formatting 전
void Kernel_task_init(void)
{
sAllocated_tcb_index = 0;
for(uint32_t i = 0; i < MAX_TASK_NUM; i++){
}
}
formatting 후
void Kernel_task_init(void)
{
sAllocated_tcb_index = 0;
for(uint32_t i = 0; i < MAX_TASK_NUM; i++)
{
}
}
vscode settings에서 설정할 수 있는 대표 스타일은 아래와 같은 것 들이 있다