SublimeClangFormat icon indicating copy to clipboard operation
SublimeClangFormat copied to clipboard

unknown key "BraceWrapping" in clang_format_custom.sublime-settings (default)

Open adsherman opened this issue 8 years ago • 3 comments

Hi! Something about the update to solve #49 has broken my ability to format. My clang_format_custom.sublime-settings (Clang format default) reflects the update, but when I go to actually format I get the error:

Clang format: YAML:1:254: error: unknown key 'BraceWrapping' {AlignTrailingComments: true, AllowShortLoopsOnASingleLine: true, BasedOnStyle: LLVM, ColumnLimit: 150, AllowShortIfStatementsOnASingleLine: true, AllowAllParametersOfDeclarationOnNextLine: false, BinPackArguments: false, UseTab: Never, BraceWrapping: {}, TabWidth: 4, IndentWidth: 4} ^ Error parsing -style: Invalid argument

adsherman avatar Jan 18 '18 13:01 adsherman

This can be fixed by editing the file "clang_format_custom.sublime-settings", which on Linux, is in "~/.config/sublime-text-3/Packages/ClangFormat/". There is a supported key that is not commented out, named "BraceWrapping". It is one of only two lines that are not commented. Comment this line, around line 150, and it's closing curly brace, on 156. Fixed.

bdennin avatar May 31 '18 00:05 bdennin

This can be fixed by editing the file "clang_format_custom.sublime-settings", which on Linux, is in "~/.config/sublime-text-3/Packages/ClangFormat/". There is a supported key that is not commented out, named "BraceWrapping". It is one of only two lines that are not commented. Comment this line, around line 150, and it's closing curly brace, on 156. Fixed.

Hi, This files doesn't exist in my linux. Although, the path to file clang_format_custom.sublime-settings is indeed "~/.config/sublime-text-3/Packages/Clang Format/" when I see it in Sublime. However I can't edit this file from within sublimetext. Do you have any workarounds?

spiky27 avatar Dec 03 '18 22:12 spiky27

Do you have any workarounds?

Your system clang-format is old and does not support BraceWrapping. Update to latest clang-format and it will work.

mrts avatar May 25 '20 10:05 mrts