forked from qt-creator/qt-creator
Insert the semicolon at the end of the trimmed line only when it is stricly necessary.
This commit is contained in:
@@ -265,6 +265,8 @@ QString QmlJSIndenter::trimmedCodeLine(const QString &t)
|
|||||||
needSemicolon = true;
|
needSemicolon = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Token::String:
|
||||||
|
case Token::Number:
|
||||||
case Token::Colon:
|
case Token::Colon:
|
||||||
case Token::LeftBracket:
|
case Token::LeftBracket:
|
||||||
case Token::RightBracket:
|
case Token::RightBracket:
|
||||||
@@ -278,7 +280,6 @@ QString QmlJSIndenter::trimmedCodeLine(const QString &t)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
needSemicolon = true;
|
|
||||||
break;
|
break;
|
||||||
} // end of switch
|
} // end of switch
|
||||||
|
|
||||||
@@ -779,8 +780,8 @@ int QmlJSIndenter::indentForContinuationLine()
|
|||||||
j + 1 < yyLine->length() && yyLine->at(j + 1) != '=') {
|
j + 1 < yyLine->length() && yyLine->at(j + 1) != '=') {
|
||||||
if (braceDepth == 0 && delimDepth == 0 &&
|
if (braceDepth == 0 && delimDepth == 0 &&
|
||||||
j < yyLine->length() - 1 &&
|
j < yyLine->length() - 1 &&
|
||||||
!yyLine->endsWith(QLatin1String(",")) &&
|
!yyLine->endsWith(QLatin1Char(',')) &&
|
||||||
(yyLine->contains('(') == yyLine->contains(')')))
|
(yyLine->contains(QLatin1Char('(')) == yyLine->contains(QLatin1Char(')'))))
|
||||||
hook = j;
|
hook = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user