Details
-
Bug
-
Resolution: Done
-
P2: Important
-
Qt Creator 4.12.2
-
Qt 5.15, QtCreator 4.12.2, ArchLinux with KDE 5.70.0, kernel 5.6.15-arch1-1
-
-
c57f6a703b611e08e86365d8a98a58cbc9a5bd94 (qt-creator/qt-creator/master)
Description
I was coding today and encountered a bug where QtCreator's automatic indentation of lines was shifted way over to the right, so every time I hit return to make a new line, it began each line with too much indentation.
After some experimentation, I find that this issue is triggered by the combination of two factors:
- The use of the new "required property" feature of QML
- The use of an object literal, i.e.
let obj = {"property": value}
The indentation problem occurs for every line in the file following the object literal.
Here is a file that reproduces the issue:
import QtQuick 2.15 Item { id: theFoo required property Item theItem function foo() { theItem.foo("The issue is exacerbated if the object literal is wrapped onto the next line like so:", {"foo": theFoo}) } }
All lines after line 10, with the object literal, will be improperly indented. If you use QtCreator's auto-indent feature over a selection or the whole file, it will also confuse the indentation.
Note that the removal of "required" from line 6 causes indentation to function normally again.
Note that I do use FakeVim, but I was able to reproduce this issue with FakeVim turned off, so I don't believe it to be related.
Attachments
Issue Links
- relates to
-
QTCREATORBUG-24376 QmlJSEditor ReformatFile removes "required" on properties
- Closed