forked from qt-creator/qt-creator
QmlOutline: Fix reordering of array elements
Make sure that a comma is added when inserting array elements into the array. Task-number: QTCREATORBUG-2796 Reviewed-by: Erik Verbruggen
This commit is contained in:
@@ -665,13 +665,13 @@ Rewriter::Range Rewriter::addObject(UiArrayBinding *ast, const QString &content,
|
|||||||
QString textToInsert;
|
QString textToInsert;
|
||||||
if (insertAfter && insertAfter->member) {
|
if (insertAfter && insertAfter->member) {
|
||||||
insertionPoint = insertAfter->member->lastSourceLocation().end();
|
insertionPoint = insertAfter->member->lastSourceLocation().end();
|
||||||
textToInsert += QLatin1String("\n");
|
textToInsert = QLatin1String(",\n") + content;
|
||||||
} else {
|
} else {
|
||||||
insertionPoint = ast->lbracketToken.end();
|
insertionPoint = ast->lbracketToken.end();
|
||||||
|
textToInsert += QLatin1String("\n") + content + QLatin1Char(',');
|
||||||
}
|
}
|
||||||
|
|
||||||
textToInsert += content;
|
m_changeSet->insert(insertionPoint, textToInsert);
|
||||||
m_changeSet->insert(insertionPoint, QLatin1String("\n") + textToInsert);
|
|
||||||
|
|
||||||
return Range(insertionPoint, insertionPoint);
|
return Range(insertionPoint, insertionPoint);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user