QmlJs: avoid adding unnecessary lines in reformatting

The reformatter used to add unnecessary empty lines, notably before
comments after import declarations.

Task-number: QTCREATORBUG-18332
Change-Id: I96d6f2dd53d1197aa6bc0b834971a66861b2f498
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
This commit is contained in:
Marco Benelli
2017-09-28 17:12:07 +02:00
parent ba050c2dd1
commit 067a7e903e

View File

@@ -187,7 +187,7 @@ protected:
{
SourceLocation fixedLoc = commentLoc;
fixCommentLocation(fixedLoc);
if (precededByEmptyLine(fixedLoc))
if (precededByEmptyLine(fixedLoc) && !_result.endsWith(QLatin1String("\n\n")))
newLine();
outCommentText(toString(fixedLoc)); // don't use the sourceloc overload here
if (followedByNewLine(fixedLoc))