[clang-format] [JS] Don't break between template string and tag
authorMartin Probst <martin@probst.io>
Tue, 19 Mar 2019 11:15:52 +0000 (11:15 +0000)
committerMartin Probst <martin@probst.io>
Tue, 19 Mar 2019 11:15:52 +0000 (11:15 +0000)
commitb274d3d79930034b8c3b2e0fc2372b66ef171eb1
treee2a5e8fcd5d5bed61d7b75970445cdda2bf1e108
parent52b49ab3fd92339cec96156396f6b7a6d48e17b2
[clang-format] [JS] Don't break between template string and tag

Before:
    const x = veryLongIdentifier
        `hello`;
After:
    const x =
        veryLongIdentifier`hello`;

While it's allowed to have the template string and tag identifier
separated by a line break, currently the clang-format output is not
stable when a break is forced. Additionally, disallowing a line break
makes it clear that the identifier is actually a tag for a template
string.

Patch originally by mitchellwills (thanks!).

llvm-svn: 356447
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTestJS.cpp