diff options
author | Lorenz Haas <lykurg@gmail.com> | 2015-06-04 17:17:10 +0200 |
---|---|---|
committer | David Schulz <david.schulz@theqtcompany.com> | 2015-06-15 10:48:17 +0000 |
commit | b0b9401870aff268561a076b15aa90ffe3ca52e2 (patch) | |
tree | 0e2f5d9c5a6eb5700734a95699489191680bb582 /src/plugins/beautifier/beautifierplugin.h | |
parent | a871e053b62240d2449d3ad7ca681ddbd1aedc86 (diff) | |
download | qt-creator-b0b9401870aff268561a076b15aa90ffe3ca52e2.tar.gz |
Beautifier: Support formatting specific lines of file with Uncrustify
It's now possible to format only a specific range of the current file.
The used tool, however, needs to support the formatting of fragments
like Uncrustify does with --frag.
Change-Id: I486a350b6301e4a087619b1e225f2a5c553ff7df
Reviewed-by: Jochen Becher <jochen_becher@gmx.de>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Diffstat (limited to 'src/plugins/beautifier/beautifierplugin.h')
-rw-r--r-- | src/plugins/beautifier/beautifierplugin.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/plugins/beautifier/beautifierplugin.h b/src/plugins/beautifier/beautifierplugin.h index f8d9517c21..3f7df9d7a4 100644 --- a/src/plugins/beautifier/beautifierplugin.h +++ b/src/plugins/beautifier/beautifierplugin.h @@ -50,19 +50,23 @@ class BeautifierAbstractTool; struct FormatTask { FormatTask(QPlainTextEdit *_editor, const QString &_filePath, const QString &_sourceData, - const Command &_command) : + const Command &_command, int _startPos = -1, int _endPos = 0) : editor(_editor), filePath(_filePath), sourceData(_sourceData), command(_command), + startPos(_startPos), + endPos(_endPos), timeout(false) {} QPointer<QPlainTextEdit> editor; QString filePath; QString sourceData; Command command; - QString formattedData; + int startPos; + int endPos; bool timeout; + QString formattedData; }; class BeautifierPlugin : public ExtensionSystem::IPlugin @@ -79,7 +83,7 @@ public: QString format(const QString &text, const Command &command, const QString &fileName, bool *timeout = 0); - void formatCurrentFile(const Command &command); + void formatCurrentFile(const Command &command, int startPos = -1, int endPos = 0); void formatAsync(QFutureInterface<FormatTask> &future, FormatTask task); static QString msgCannotGetConfigurationFile(const QString &command); |