aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/cppeditordocument.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2023-06-30 15:16:28 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2023-07-03 08:47:42 +0000
commita39119669c3c040c612416fb88a0366e0852f2f3 (patch)
tree94c31c09f3296f846c48c86da6474c9ac6e21499 /src/plugins/cppeditor/cppeditordocument.cpp
parent64c8c37bd479a4d1d284e552e5c02e47a288ff0a (diff)
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>
Diffstat (limited to 'src/plugins/cppeditor/cppeditordocument.cpp')
-rw-r--r--src/plugins/cppeditor/cppeditordocument.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/cppeditor/cppeditordocument.cpp b/src/plugins/cppeditor/cppeditordocument.cpp
index 0398674941..9e7856b74b 100644
--- a/src/plugins/cppeditor/cppeditordocument.cpp
+++ b/src/plugins/cppeditor/cppeditordocument.cpp
@@ -467,7 +467,7 @@ bool CppEditorDocument::saveImpl(QString *errorString, const FilePath &filePath,
if (!editedRanges.empty()) {
QTextCursor cursor(document());
cursor.joinPreviousEditBlock();
- indenter()->format(editedRanges);
+ indenter()->format(editedRanges, Indenter::FormattingMode::Forced);
cursor.endEditBlock();
}