qtdeclarative/tests/auto/qmldom
Sami Shalayel a50af19873 qmlformat: Fix ScriptFormatter for blocks/statements comments
Component.onCompleted: {
    if(true) /* true */ {
        // the true clause
    } else {
        // the else clause
    }
}

was formatted to :

Component.onCompleted: {
   if (true /* true */)
   // the true clause
   {} else
   // the else clause
   {}
}

Add a new parameter to outWithComments that allows to change the
indentation. The use cases are:
```
{
    // 1) some comment attached to '{'
    ...
    // 2) some comment attached to '}'
}
```
For 1), IncreaseIndentation prints '{' and then increase the
indentation before printing any post comment.

For 2), DecreaseIndentation prints the pre comments, decrease the
indentation and then proceed with '}' and potential post comments.

This allows to print the comments attached to `{}` tokens with the
correct indentation.

Also adapt a test to the new comment behavior on blocks.

Pick-to: 6.10
Task-number: QTCREATORBUG-33333
Task-number: QTBUG-123386
Change-Id: If8dd483a520c3bd25e161f3cec05530c1460bb80
Initial-patch-by: Xavier BESSON <developer@xavi-b.fr>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-09-18 15:42:19 +02:00
..
combined Correct license for test files 2024-02-27 10:32:21 +01:00
domdata qmlformat: Fix ScriptFormatter for blocks/statements comments 2025-09-18 15:42:19 +02:00
domitem dom: workaround mixed import paths in commitToBase 2025-06-16 10:19:27 +02:00
errormessage Tests: include QTest, not QtTest 2025-04-15 19:27:07 +02:00
filelocations Tests: include QTest, not QtTest 2025-04-15 19:27:07 +02:00
merging Tests: include QTest, not QtTest 2025-04-15 19:27:07 +02:00
path Tests: include QTest, not QtTest 2025-04-15 19:27:07 +02:00
reformatter qmlformat: Fix ScriptFormatter for blocks/statements comments 2025-09-18 15:42:19 +02:00
stringdumper Tests: include QTest, not QtTest 2025-04-15 19:27:07 +02:00
CMakeLists.txt QmlDom improve reliability of FileLocations 2024-11-28 13:16:01 +01:00