Index: lib/Format/UnwrappedLineParser.cpp =================================================================== --- lib/Format/UnwrappedLineParser.cpp +++ lib/Format/UnwrappedLineParser.cpp @@ -744,7 +744,7 @@ Keywords.kw_let, Keywords.kw_var, tok::kw_const, Keywords.kw_abstract, Keywords.kw_extends, Keywords.kw_implements, Keywords.kw_instanceof, Keywords.kw_interface, - Keywords.kw_throws)); + Keywords.kw_throws, Keywords.kw_from)); } static bool mustBeJSIdentOrValue(const AdditionalKeywords &Keywords, Index: unittests/Format/FormatTestJS.cpp =================================================================== --- unittests/Format/FormatTestJS.cpp +++ unittests/Format/FormatTestJS.cpp @@ -1456,6 +1456,17 @@ " A,\n" "} from 'some/module.js';", Style); + Style.ColumnLimit = 40; + // Using this version of verifyFormat because test::messUp hides the issue. + verifyFormat("import {\n" + " A,\n" + "} from\n" + " 'some/path/longer/than/column/limit/module.js';", + "import {\n" + " A,\n" + "} from\n" + " 'some/path/longer/than/column/limit/module.js';", + Style); } TEST_F(FormatTestJS, TemplateStrings) { Index: unittests/Format/SortImportsTestJS.cpp =================================================================== --- unittests/Format/SortImportsTestJS.cpp +++ unittests/Format/SortImportsTestJS.cpp @@ -283,6 +283,38 @@ "1;"); } +TEST_F(SortImportsTestJS, SortMultiLine) { + verifySort("import {A} from 'aa';\n" + "import {A} from 'bb';\n" + "\n" + "1;", + "import {A} from 'bb';\n" + "import {A}\n" + "from 'aa';\n" + "\n" + "1;"); + verifySort("import {A} from 'aa';\n" + "import {A} from 'bb';\n" + "\n" + "1;", + "import\n" + "{A} from 'bb';\n" + "import {A}\n" + "from 'aa';\n" + "\n" + "1;"); + verifySort("import {A} from 'aa';\n" + "import {A} from 'bb';\n" + "\n" + "1;", + "import {A} from\n" + "'bb';\n" + "import {A}\n" + "from 'aa';\n" + "\n" + "1;"); +} + } // end namespace } // end namespace format } // end namespace clang