From c8b7a41a00591c4852ac583cf2bc4c7d34b2fded Mon Sep 17 00:00:00 2001 From: Martin Probst Date: Mon, 11 Jun 2018 16:20:13 +0000 Subject: clang-format: [JS] strict prop init annotation. Summary: TypeScript uses the `!` token for strict property initialization assertions, as in: class X { strictPropAsserted!: string; } Previously, clang-format would wrap between the `!` and the `:` for overly long lines. This patch fixes that by generally preventing the wrap in that location. Reviewers: krasimir Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48030 llvm-svn: 334415 --- clang/unittests/Format/FormatTestJS.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/unittests') diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 1d610555778..9975b7d3112 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -1540,6 +1540,15 @@ TEST_F(FormatTestJS, ClassDeclarations) { "}"); } +TEST_F(FormatTestJS, StrictPropInitWrap) { + const FormatStyle &Style = getGoogleJSStyleWithColumns(22); + verifyFormat("class X {\n" + " strictPropInitField!:\n" + " string;\n" + "}", + Style); +} + TEST_F(FormatTestJS, InterfaceDeclarations) { verifyFormat("interface I {\n" " x: string;\n" -- cgit v1.2.3