ClangFormat: Add disable option

- Added a possibility to disable ClangFormat plugin
- Removed unneeded properties from clangformatsettings

Change-Id: If71f46670e4fd3d2dac6d18c97df5a811504ed5e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Artem Sokolovskii
2022-05-12 12:51:51 +02:00
parent 10dd3706fa
commit 0b6fca2293
9 changed files with 76 additions and 109 deletions

View File

@@ -28,6 +28,7 @@
#include "clangformatconfigwidget.h"
#include "clangformatconstants.h"
#include "clangformatindenter.h"
#include "clangformatsettings.h"
#include "clangformatutils.h"
#include "tests/clangformat-test.h"
@@ -56,6 +57,7 @@
#include <projectexplorer/target.h>
#include <texteditor/icodestylepreferences.h>
#include <texteditor/textindenter.h>
#include <texteditor/texteditorsettings.h>
#include <clang/Format/Format.h>
@@ -81,6 +83,8 @@ 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);
}