Commit Graph

6 Commits

Author SHA1 Message Date
Maximilian Goldstein 237a0e86c7 qmlformat: Copy string literals verbatim
Copy string literals verbatim instead of reformatting them.

Fixes: QTBUG-84599
Change-Id: I36307eb30faa586f50cf0ce2660fb4e2686a3e4a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-06-17 13:04:42 +02:00
Maximilian Goldstein 4faf242d1a qmlformat: Add option for alternative line endings
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>
2020-03-25 06:15:13 +01:00
Simon Hausmann 8ab237edf1 Restore offset/length in QQmlJS::DiagnosticMessage
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 d4d197d062

Change-Id: Ifb9d344228e3c6e9e26fc4fe112686f9336ea2b2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-03-02 10:35:50 +01:00
Maximilian Goldstein e080f48f90 qmlformat: Support even more language features
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>
2020-01-30 08:24:40 +01:00
Maximilian Goldstein 9e674be4fb qmlformat: Fix some language features being unsupported
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>
2020-01-17 10:02:29 +01:00
Maximilian Goldstein 73189151b5 qtdeclarative/tools: Implement qmlformat
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>
2019-12-19 16:45:51 +01:00