From a4e55f4d1ec87056703c752644e12640e97fb5a1 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Thu, 4 Dec 2014 16:07:17 +0000 Subject: clang-format: [JS] Don't put top-level dict literals on a single line. These are often used for enums which apparently are easier to read if formatted with one element per line. llvm-svn: 223367 --- clang/lib/Format/TokenAnnotator.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/Format/TokenAnnotator.cpp') diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 9f692437cad..ede60eede3c 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1891,6 +1891,9 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, if (Right.is(tok::char_constant) && Left.is(tok::plus) && Left.Previous && Left.Previous->is(tok::char_constant)) return true; + if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace) && + Left.NestingLevel == 0) + return true; } else if (Style.Language == FormatStyle::LK_Java) { if (Left.is(TT_LeadingJavaAnnotation) && Right.isNot(tok::l_paren) && Line.Last->is(tok::l_brace)) -- cgit v1.2.3