Details
-
Epic
-
Resolution: Unresolved
-
P2: Important
-
None
Description
What is the benefit? Why is this valuable?
Use essentials QML tooling in Qt Creator
What are common use cases?
- Run qmlformat for a single file
- Run qmlformat for a selected section of a file ("Edit" > "Advanced" > "Auto-format Selection"/"Auto-indent Selection")
- Run qmlformat for the whole project
Technical information
There are a few place that formatting can be triggered in QtC.
Full document formatting:
Tools -> Qml/JS -> Reformat
Preferences -> QtQuick -> Qml/Js Editing -> Enable auto format on file save
Range formatting:
RightClick on qml editor -> Auto indent selection
Edit -> Advanced -> Auto indent selection
- As a first step, replace the embedded formatter with QML tooling for these actions. When enabled, use qmlls otherwise use standalone qmlformat tool.
- For range formatting, first implement the auto-indent functionality in qmlformat (this is already in for qmlls but not for standalone qmlformat. See QTBUG-127306). Regarding "Auto-format Selection", it should be done as follow-up feature to this as full formatting of ranges is not supported in the embedded formatter, too.
- Add a new action in the menu to trigger qmlformat for all the qmlfiles in the project.
- Respect the tabs and indentation policy in the Pref -> QtQuick -> CodeStyle
Attachments
Issue Links
- depends on
-
QTBUG-119967 qmlformat: reach feature parity with QtC built-in formatter
- Reported
-
QTBUG-127306 qmlformat: Support formatting a subsection of a file
- Reported
- is duplicated by
-
QTCREATORBUG-31684 Built in QML/JS Formatting breaks JS classes
- Closed
- is required for
-
QTCREATORBUG-29138 QML auto format rewrites computed property names
- Reported
-
QTCREATORBUG-29383 QML/JS Reformat File will remove Bound in pragma ComponentBehavior: Bound
- Closed
-
QTCREATORBUG-28192 QtCreator QML formatting vs. qmlformat.exe
- Closed
- relates to
-
QTCREATORBUG-17224 Integration of QML Lint in Qt Creator
- Closed
-
QTCREATORBUG-32009 pragma ValueTypeBehavior: Addressable is truncated into pragma ValueTypeBehavior
- Closed
- replaces
-
QTCREATORBUG-29487 QML/JS formatting should not format string bloc
- Closed
- resulted in
-
QTBUG-116139 Add full formatting capabilities to selected range formatting
- Reported
- mentioned in
-
Page Loading...
Gerrit Reviews
For Gerrit Dashboard: QTCREATORBUG-26602 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
605366,8 | wip:qmlformat:refactor | dev | qt/qtdeclarative | Status: NEW | -2 | 0 |
441820,14 | Optionally use qmlformat for Qt Quick auto format on save | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
605363,1 | Remove leftover debug function call | dev | qt/qtdeclarative | Status: ABANDONED | 0 | 0 |