diff options
| author | Daniel Jasper <djasper@google.com> | 2014-01-15 15:09:08 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2014-01-15 15:09:08 +0000 |
| commit | fe63cbf5be9ed5032bcbcd21f426156e595fa52b (patch) | |
| tree | afe9f863a12ed4c3c574e67a61619f6f75c29d3e /lib/Format/Format.cpp | |
| parent | ca370127430c6c53514ebda0f8e2b5bdeaf7825b (diff) | |
| download | clang-fe63cbf5be9ed5032bcbcd21f426156e595fa52b.tar.gz clang-fe63cbf5be9ed5032bcbcd21f426156e595fa52b.tar.bz2 clang-fe63cbf5be9ed5032bcbcd21f426156e595fa52b.tar.xz | |
clang-format: Fixed formatting of JavaScript container literals
Before:
var arr = [ 1, 2, 3 ];
var obj = {a : 1, b : 2, c : 3};
After:
var arr = [1, 2, 3];
var obj = {a: 1, b: 2, c: 3};
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199317 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
| -rw-r--r-- | lib/Format/Format.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 43651e2c63..a69570a157 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -190,6 +190,8 @@ template <> struct MappingTraits<FormatStyle> { IO.mapOptional("SpaceInEmptyParentheses", Style.SpaceInEmptyParentheses); IO.mapOptional("SpacesInCStyleCastParentheses", Style.SpacesInCStyleCastParentheses); + IO.mapOptional("SpacesInContainerLiterals", + Style.SpacesInContainerLiterals); IO.mapOptional("SpaceBeforeAssignmentOperators", Style.SpaceBeforeAssignmentOperators); IO.mapOptional("ContinuationIndentWidth", Style.ContinuationIndentWidth); @@ -271,6 +273,7 @@ FormatStyle getLLVMStyle() { LLVMStyle.UseTab = FormatStyle::UT_Never; LLVMStyle.SpacesInParentheses = false; LLVMStyle.SpaceInEmptyParentheses = false; + LLVMStyle.SpacesInContainerLiterals = true; LLVMStyle.SpacesInCStyleCastParentheses = false; LLVMStyle.SpaceBeforeParens = FormatStyle::SBPO_ControlStatements; LLVMStyle.SpaceBeforeAssignmentOperators = true; @@ -316,9 +319,7 @@ FormatStyle getGoogleJSStyle() { FormatStyle GoogleJSStyle = getGoogleStyle(); GoogleJSStyle.Language = FormatStyle::LK_JavaScript; GoogleJSStyle.BreakBeforeTernaryOperators = false; - // FIXME: Currently unimplemented: - // var arr = [1, 2, 3]; // No space after [ or before ]. - // var obj = {a: 1, b: 2, c: 3}; // No space after ':'. + GoogleJSStyle.SpacesInContainerLiterals = false; return GoogleJSStyle; } |
