Clang: Use clang-format for indentation

This is the new experimental plugin based on LibFormat.

It replaces the default indenter for CppEditorDocument
and applies clang-format after the CR or the set of 'electric'
characters.

Uses the global .clang-format kept in QtC settings or
the one for current project. Both can be configured.

For indentation some style modifications and code manipulations
are done to prevent line shrinking when it's not expected.

Manual indentation uses unmodified style from .clang-format file.

Change-Id: I6279b805e418e1804b553efa615f5c843f395a58
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Ivan Donchevskii
2018-08-29 15:58:13 +02:00
parent b95b675e41
commit ca84a51f86
35 changed files with 1294 additions and 87 deletions

View File

@@ -39,6 +39,7 @@
#include "cpplocatordata.h"
#include "cpplocatorfilter.h"
#include "cppmodelmanagersupportinternal.h"
#include "cppqtstyleindenter.h"
#include "cpprefactoringchanges.h"
#include "cpprefactoringengine.h"
#include "cppsourceprocessor.h"
@@ -61,6 +62,7 @@
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectmacro.h>
#include <projectexplorer/session.h>
#include <texteditor/indenter.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
@@ -507,7 +509,9 @@ void CppModelManager::initializeBuiltinModelManagerSupport()
}
CppModelManager::CppModelManager()
: CppModelManagerBase(nullptr), d(new CppModelManagerPrivate)
: CppModelManagerBase(nullptr)
, createCppIndenter([]() { return new CppQtStyleIndenter; })
, d(new CppModelManagerPrivate)
{
d->m_indexingSupporter = 0;
d->m_enableGC = true;