LanguageClient: Indent code coming from the server

... if the client implementation requests it.
The server is not necessarily aware of our indentation style, so we
might have to apply it to the newly inserted code.

Change-Id: I43518575c7124568da42be3b04a28d7f352f6dc2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-02-03 10:36:40 +01:00
parent 9b7f580a14
commit 92156cc1d6
11 changed files with 100 additions and 72 deletions

View File

@@ -27,6 +27,9 @@
#include "cppeditor_global.h"
#include "cppmodelmanager.h"
#include "cppworkingcopy.h"
#include <cplusplus/CppDocument.h>
#include <texteditor/refactoringchanges.h>
@@ -79,6 +82,26 @@ protected:
friend class CppRefactoringChanges; // for access to constructor
};
class CPPEDITOR_EXPORT CppRefactoringChangesData : public TextEditor::RefactoringChangesData
{
public:
explicit CppRefactoringChangesData(const CPlusPlus::Snapshot &snapshot);
void indentSelection(const QTextCursor &selection,
const Utils::FilePath &filePath,
const TextEditor::TextDocument *textDocument) const override;
void reindentSelection(const QTextCursor &selection,
const Utils::FilePath &filePath,
const TextEditor::TextDocument *textDocument) const override;
void fileChanged(const Utils::FilePath &filePath) override;
CPlusPlus::Snapshot m_snapshot;
CppModelManager *m_modelManager;
WorkingCopy m_workingCopy;
};
class CPPEDITOR_EXPORT CppRefactoringChanges: public TextEditor::RefactoringChanges
{
public: