aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlformat
Commit message (Collapse)AuthorAgeFilesLines
* qmlformat: Remove import sortingMaximilian Goldstein2020-12-163-54/+9
| | | | | | | | | | | Remove import sorting due to the fact that sorting imports can break code. [ChangeLog][QML Tooling][qmlformat] Remove import sorting and the (now obsolete) -n parameter to disable it Fixes: QTBUG-89295 Change-Id: I5ff13d0ae3c715db7645b412152aadb31811ce5a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit cf3e0559b01b249a6ec06f8826e8e05aca1301ec)
* qmlformat: Make arrow functions one linersMaximilian Goldstein2020-10-081-4/+16
| | | | | | Fixes: QTBUG-87179 Change-Id: Ieb7dffab59923bcb2ce8745c499eff7de44134b1 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: Make empty objects one linersMaximilian Goldstein2020-10-071-0/+4
| | | | | | Fixes: QTBUG-87181 Change-Id: Ic8b7f69b4f9faf907ec75f27b689ba3686eb013f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: Fix computed property namesMaximilian Goldstein2020-10-071-1/+5
| | | | | | | Fixes: QTBUG-87222 Pick-to: 5.15 Change-Id: If1da02d503041009b82651e1087fb4a1bdd79d59 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-10-062-2/+2
| | | | | | | | Modify special case locations to use the new API as well. Task-number: QTBUG-86815 Change-Id: I3b964e3baf0cc7040830156dac30358ea1152801 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* qmlformat: Fix formatting of for...of loops using array variablesMaximilian Goldstein2020-10-061-1/+4
| | | | | | | Fixes: QTBUG-86980 Pick-to: 5.15 Change-Id: Id27350821051709894c7645a362cfdf7ce0d279c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: Fix inline componentsMaximilian Goldstein2020-10-052-38/+11
| | | | | | | Fixes: QTBUG-86979 Pick-to: 5.15 Change-Id: Ie8863bc2ecf75a9dd8e4af5e96e48c30e7acbacd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: Fix multiline comment attachmentMaximilian Goldstein2020-09-042-2/+11
| | | | | | Pick-to: 5.15 Change-Id: I3ba8a4cd683df3309dd6df31b1fd426a0875f8fa Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove last remaining use of QStringRefKarsten Heimrich2020-08-231-1/+1
| | | | | Change-Id: I91685ac4cf1f5186d58252587fb8c7d7375372b2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: fix handling of "if else" inside "if" in "if else"Evgeniy A. Dushistov2020-08-202-14/+41
| | | | | | Fixes: QTBUG-86060 Change-Id: I7a191c451793bf4e1f6a2bd02ceb36b5957136c2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* CMake: Regenerate projectsAlexandru Croitor2020-07-092-2/+4
| | | | | | | | | We need the qt_add_tool changes to successfully configure qemu builds. The rest of the changes are just to be in sync with the .pro files. Change-Id: I7bcc08ac58f57a5761aedef09761428c55235289 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* qmlformat: Allow for minor and major versions to be omittedMaximilian Goldstein2020-07-081-2/+8
| | | | | Change-Id: I85897930980bb98ba9f968cdf70696547493b1d5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: Fix handling of empty blocksMaximilian Goldstein2020-07-021-1/+7
| | | | | | | | | | Empty blocks were often not handled properly. (i.e. in if, for and while blocks) Fixes: QTBUG-85321 Pick-to: 5.15 Change-Id: I4035dd239a095814362e0aec142b387dc113f282 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: Fix template literalsMaximilian Goldstein2020-07-021-0/+6
| | | | | | | Fixes: QTBUG-85317 Pick-to: 5.15 Change-Id: I52589b681690a55f7bba7d7d9c675dc22ffa1587 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: Fix multiline bindingsMaximilian Goldstein2020-07-011-0/+12
| | | | | | | | | | Some bindings may turn multiline while formatting. This change makes sure this is handled properly. Fixes: QTBUG-85289 Pick-to: 5.15 Change-Id: I6df98b926d69a23480003c3d9705bc34c3dd0d5d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: Add files optionMaximilian Goldstein2020-06-251-4/+29
| | | | | | | | Adds a flag for formatting files listed in a file Fixes: QTBUG-85078 Change-Id: I235db3ad52291d2c211b092b8505340728be3949 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: Fix nested functionsMaximilian Goldstein2020-06-252-4/+15
| | | | | | Fixes: QTBUG-85035 Change-Id: I5e1cb003b7b84547e3408a086eebf3be740e6860 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: Fix inline componentsMaximilian Goldstein2020-06-252-0/+44
| | | | | | Fixes: QTBUG-85189 Change-Id: I2b30595b44d14b89406b126d3d148f51f8bfbca4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: Fix nested ifsMaximilian Goldstein2020-06-181-19/+21
| | | | | | Fixes: QTBUG-85077 Change-Id: Ia2fec64a389fd7355f3fcf9438408b021c5abef4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: Fix trailing newline in if blocksMaximilian Goldstein2020-06-171-0/+4
| | | | | | Fixes: QTBUG-85003 Change-Id: Ie68c838c9bc1d52181a741871279bee5a8020855 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: Copy string literals verbatimMaximilian Goldstein2020-06-173-5/+10
| | | | | | | | Copy string literals verbatim instead of reformatting them. Fixes: QTBUG-84599 Change-Id: I36307eb30faa586f50cf0ce2660fb4e2686a3e4a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Regenerate qtdeclarative/toolsAlexandru Croitor2020-05-292-0/+2
| | | | | | | | Includes - A bunch of TARGET_DESCRIPTION Change-Id: I6acfe05187afbdd45cf7e1bf8634f1554a51c791 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix 'as' binary operation using invalid typesMaximilian Goldstein2020-05-201-3/+3
| | | | | | | Fixes: QTBUG-81392 Change-Id: Ic83091c547a7854b7fa86b44d93c575bd7426bae Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-094-13/+79
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4executablecompilationunit.cpp src/qml/jsruntime/qv4executablecompilationunit_p.h src/qml/qml/qqmlobjectcreator.cpp src/qml/qml/qqmlpropertycachecreator_p.h src/qml/qml/qqmltypecompiler.cpp src/qml/qml/qqmltypedata.cpp tests/auto/qml/qmlformat/tst_qmlformat.cpp tools/qmllint/scopetree.cpp src/qml/qml/qqmlapplicationengine_p.h Adjusted tools/qmllint/findunqualified.cpp to use newer API Change-Id: Ibfb4678ca39d626d47527265e3c96e43313873d4
| * qmlformat: Fix inconsistent if statementsMaximilian Goldstein2020-03-251-4/+30
| | | | | | | | | | | | | | | | Should now produce more consistent output for if statements. Fixes: QTBUG-82261 Change-Id: I39da0c80c4aadc2c5bdef32953c34ed9f0708a9e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * qmlformat: Improve comment attachmentMaximilian Goldstein2020-03-253-5/+18
| | | | | | | | | | | | | | | | | | | | - Fixes UiPublicMember nodes having a newline between comment and first node - Implements a Front_Inline type so comments at the beginning of object definitions are handled properly Fixes: QTBUG-82259 Change-Id: I0b40290037ce88a9ffe16390d72cbf3d704db41a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * qmlformat: Add option for alternative line endingsMaximilian Goldstein2020-03-251-4/+31
| | | | | | | | | | | | | | | | | | Allows user to decide between native (default), macos (\r), unix (\n) or windows (\r\n) line endings. Fixes: QTBUG-82258 Change-Id: Ie1eb365085815cbbebbf0d026c6f72f0ef2acb9d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | CMake: Regenerate and adapt to merge from devwip/cmakeAlexandru Croitor2020-03-122-0/+39
| | | | | | | | | | | | Change-Id: If8daa6152a563d4309d7342414780ef75b9f5589 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-093-2/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmlirbuilder_p.h src/qml/qml/qqmlpropertycachecreator_p.h src/qmltyperegistrar/qmltypesclassdescription.cpp src/qmltyperegistrar/qmltypesclassdescription.h src/qmltyperegistrar/qmltypescreator.cpp src/quick/items/qquicktext_p.h src/quick/util/qquickvaluetypes_p.h Change-Id: Ic209741592e7b85820bf3845722023a190ebc1c5
| * Restore offset/length in QQmlJS::DiagnosticMessageSimon Hausmann2020-03-023-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | This is needed in a few places outside of declarative, so this change restores the loc member in DiagnosticMessage and moves QQmlJS::AST::SourceLocation into common's QQmlJS namespace/directory. QQmlError is unaffected and retains only line/column. Amends d4d197d06279f9257647628f7e1ccc9ec763a6bb Change-Id: Ifb9d344228e3c6e9e26fc4fe112686f9336ea2b2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-02-172-0/+47
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/qtqml/plugin.cpp src/qml/qml/qqml.h src/qml/qml/qqmlmetatype.cpp src/qml/qml/qqmlmetatype_p.h src/qml/qml/qqmltypeloader.cpp src/qml/types/qqmlbind.cpp src/quick/items/qquickitemsmodule.cpp tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp Change-Id: I52548938a582cb6510271ed4bc3a9aa0c3c11df6
| * qmlformat: preserve annotationsFawzi Mohamed2020-02-122-0/+47
| | | | | | | | | | | | Change-Id: I22e72d91f6d422e93a7ebc642a8449cb490aec20 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* | qmlformat: Enforce more of the coding conventionsMaximilian Goldstein2020-02-121-1/+54
| | | | | | | | | | | | | | | | | | Now also enforces: - states and transitions being the last elements in an object - large bindings being the last bindings Change-Id: I8be1db4eb2bc9dd429dd5b9abab70a1362f47dfb Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Use QTypeRevision for all versions and revisionsUlf Hermann2020-02-031-2/+2
|/ | | | | | | | | | | | | | In many places we carry major and minor versions or revisions that are loosely coupled to minor versions. As the Qt minor version resets now, we need to handle these things more systematically. In particular, we need to add a "major" part to revisions. QTypeRevision can express the current major/minor pairs more efficiently and can also be used to add a major version to revisions. This change does not change the semantics, yet, but only replaces the types. Change-Id: Ie58ba8114d7e4c6427f0f28716deee71995c0d24 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: Support even more language featuresMaximilian Goldstein2020-01-305-101/+330
| | | | | | | | | | | | | | Adds support (among other things) for: - Pragmas - Type annotations - get / set properties - Some previously unsupported escape sequences (\b,\v...) - Calling methods on numeric literals Also now checks whether the dumped code is still parsable. Change-Id: Ia142a7c0b3e608115e79c1d98a62b682dce4eec9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: Fix some language features being unsupportedMaximilian Goldstein2020-01-173-15/+103
| | | | | | | | | | | | | | | | | | | qmlformat now supports: - arrow functions - generator functions - this expressions - object patterns - regex literals - type expressions - plain expressions Aborts if an error occurs during dumping now. Also now automatically tests qmlformat against all example / test qml files. Change-Id: Idc24004c6f2c1cd65289bcad75985a1ef047c8d2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat: Fix default construction of CommentUlf Hermann2020-01-101-2/+2
| | | | | | | m_location would be uninitialized. Change-Id: Ieeeb0c0783a0b8e6f919019bd2ddcc1752993eaf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmlformat/dumpastvisitor: Fix a few segfaultsMaximilian Goldstein2020-01-091-3/+8
| | | | | | Change-Id: Ic8e95944cf36000a004d010293a532101433c3af Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmlformat: Fix whitespace for parameter defaultsMaximilian Goldstein2020-01-082-5/+5
| | | | | Change-Id: I7958bf1546cc5854fc9b9856e36928ea932af0ca Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* tools/qmlformat: Improve formatting quite a bitMaximilian Goldstein2019-12-203-18/+72
| | | | | | | | | | - Fix strings not getting properly escaped - Fix if/else blocks not getting formatted correctly in some cases - Remove unnecessary newlines - Improve comment attachment Change-Id: Id8264c069315b3c6bd9ba8e8ac991dbdce8581a7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qtdeclarative/tools: Implement qmlformatMaximilian Goldstein2019-12-198-0/+1860
qmlformat is a tool that formats qml files according to the QML coding conventions (https://doc.qt.io/qt-5/qml-codingconventions.html). Change-Id: I359c4bd3b51f60614535f0e857d7e0b21b1d9033 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>