rosshemsley / SublimeClangFormat

A C++ code formatter based on Clang Format, for beautiful code with minimal effort in Sublime Text 3
Other
185 stars 52 forks source link

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

Open adsherman opened 6 years ago

adsherman commented 6 years ago

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

bdennin commented 6 years ago

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.

spiky27 commented 5 years ago

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?

mrts commented 4 years ago

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.