diff --git a/src/libs/qmljs/qmljsreformatter.cpp b/src/libs/qmljs/qmljsreformatter.cpp index 52b5afc0b1d..de69df50438 100644 --- a/src/libs/qmljs/qmljsreformatter.cpp +++ b/src/libs/qmljs/qmljsreformatter.cpp @@ -802,6 +802,13 @@ protected: bool visit(StringLiteralPropertyName *ast) override { out(ast->id.toString()); return true; } bool visit(NumericLiteralPropertyName *ast) override { out(QString::number(ast->id)); return true; } + bool visit(TemplateLiteral *ast) override + { + out(ast->literalToken); + accept(ast->expression); + return true; + } + bool visit(ArrayMemberExpression *ast) override { accept(ast->base); diff --git a/tests/auto/qml/reformatter/jssyntax.js b/tests/auto/qml/reformatter/jssyntax.js index c59e73e77e2..edba1a406cf 100644 --- a/tests/auto/qml/reformatter/jssyntax.js +++ b/tests/auto/qml/reformatter/jssyntax.js @@ -21,6 +21,11 @@ const func4 = (x, y) => { return x + y } +const s1 = `test` +const s2 = `${42 * 1}` +const s3 = `test ${s2}` +const s4 = `${s2}${s3}test` + while (true) { for (var a = 1; a < 5; ++a) { switch (a) {