ClangFormat: Make formatting mode a project option

- Added the possibility to set formatting mode for every project
separately. The indenter will be switched for a file if the mode
changes.

Fixes: QTCREATORBUG-28188
Change-Id: I4e7f9841c54f9b6763586c16672a10ca36bf843d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Artem Sokolovskii
2022-12-12 15:30:29 +01:00
committed by Christian Kandeler
parent 192605f01c
commit feb72dd084
5 changed files with 194 additions and 14 deletions

View File

@@ -62,9 +62,7 @@ class ClangFormatStyleFactory : public CppEditor::CppCodeStylePreferencesFactory
public:
TextEditor::Indenter *createIndenter(QTextDocument *doc) const override
{
if (ClangFormatSettings::instance().mode() == ClangFormatSettings::Disable)
return CppEditor::CppCodeStylePreferencesFactory::createIndenter(doc);
return new ClangFormatIndenter(doc);
return new ClangFormatForwardingIndenter(doc);
}
std::pair<CppEditor::CppCodeStyleWidget *, QString> additionalTab(