Index: cfe/trunk/lib/Format/UnwrappedLineParser.cpp =================================================================== --- cfe/trunk/lib/Format/UnwrappedLineParser.cpp +++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp @@ -747,7 +747,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: cfe/trunk/unittests/Format/FormatTestJS.cpp =================================================================== --- cfe/trunk/unittests/Format/FormatTestJS.cpp +++ cfe/trunk/unittests/Format/FormatTestJS.cpp @@ -1464,6 +1464,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: cfe/trunk/unittests/Format/SortImportsTestJS.cpp =================================================================== --- cfe/trunk/unittests/Format/SortImportsTestJS.cpp +++ cfe/trunk/unittests/Format/SortImportsTestJS.cpp @@ -283,6 +283,23 @@ "1;"); } +TEST_F(SortImportsTestJS, SortMultiLine) { + // Reproduces issue where multi-line import was not parsed correctly. + verifySort("import {A} from 'a';\n" + "import {A} from 'b';\n" + "\n" + "1;", + "import\n" + "{\n" + "A\n" + "}\n" + "from\n" + "'b';\n" + "import {A} from 'a';\n" + "\n" + "1;"); +} + } // end namespace } // end namespace format } // end namespace clang