forked from qt-creator/qt-creator
ClangFormat: Introduce check to format code instead of indenting
Ctrl+I with the new check will reformat the selected code or the current line instead. Change-Id: Ia5a72c4a09621034d0dfe463f669fe1ca36b0b5f Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -45,6 +45,9 @@ public:
|
||||
void reindent(const QTextCursor &cursor,
|
||||
const TextEditor::TabSettings & /*tabSettings*/) override;
|
||||
|
||||
void formatOrIndent(const QTextCursor &cursor,
|
||||
const TextEditor::TabSettings &tabSettings,
|
||||
int cursorPositionInEditor = -1) override;
|
||||
TextEditor::Replacements format(const QTextCursor &cursor,
|
||||
const TextEditor::TabSettings & /*tabSettings*/) override;
|
||||
|
||||
@@ -58,8 +61,10 @@ public:
|
||||
|
||||
protected:
|
||||
virtual clang::format::FormatStyle styleForFile() const;
|
||||
virtual bool formatCodeInsteadOfIndent() const { return false; }
|
||||
|
||||
private:
|
||||
TextEditor::Replacements format(const QTextCursor &cursor);
|
||||
void indent(const QTextCursor &cursor, const QChar &typedChar);
|
||||
void indentBlock(const QTextBlock &block, const QChar &typedChar);
|
||||
int indentFor(const QTextBlock &block);
|
||||
|
||||
Reference in New Issue
Block a user