CppEditor: Format quickfix code only if formatting is enabled

... in the ClangFormat settings (rather than the default of just
indenting).
As opposed to files generated by the wizard, quickfixes are often touching
existing code, and since ClangFormat works on line granularity, users
will experience unexpected re-formattings when ClangFormat is in indent-
only mode.
Therefore, do the formatting only if the user has enabled it in the
ClangFormat settings.

Change-Id: Icb30f166f2b6fb94113a8f25c4a5f92ff8bca9b0
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Christian Kandeler
2023-06-30 15:16:28 +02:00
parent 64c8c37bd4
commit a39119669c
10 changed files with 40 additions and 8 deletions

View File

@@ -31,7 +31,8 @@ public:
void autoIndent(const QTextCursor &cursor,
const TextEditor::TabSettings &tabSettings,
int cursorPositionInEditor = -1) override;
Utils::Text::Replacements format(const TextEditor::RangesInLines &rangesInLines) override;
Utils::Text::Replacements format(const TextEditor::RangesInLines &rangesInLines,
FormattingMode mode = FormattingMode::Forced) override;
void indentBlock(const QTextBlock &block,
const QChar &typedChar,