forked from qt-creator/qt-creator
Texteditor: Add ability to get margin from indenter
And implement it in the clang-format plugin to use the ColumnLimit from the style. This would be quite useful if you're working on different projects with a different ColumnLimit. This way you get an visual representation and do not only have to rely on clang-format. Change-Id: Ib0258e3fba6f45f0f46ce612f806527a47868ad9 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
committed by
Björn Schäpers
parent
069efa9483
commit
d9cd74f06d
@@ -679,6 +679,11 @@ bool ClangFormatBaseIndenter::isElectricCharacter(const QChar &ch) const
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<int> ClangFormat::ClangFormatBaseIndenter::margin() const
|
||||
{
|
||||
return styleForFile().ColumnLimit;
|
||||
}
|
||||
|
||||
void ClangFormatBaseIndenter::autoIndent(const QTextCursor &cursor,
|
||||
const TextEditor::TabSettings & /*tabSettings*/,
|
||||
int cursorPositionInEditor)
|
||||
|
||||
@@ -66,6 +66,8 @@ public:
|
||||
|
||||
bool isElectricCharacter(const QChar &ch) const override;
|
||||
|
||||
std::optional<int> margin() const override;
|
||||
|
||||
protected:
|
||||
virtual clang::format::FormatStyle styleForFile() const;
|
||||
virtual bool formatCodeInsteadOfIndent() const { return false; }
|
||||
|
||||
Reference in New Issue
Block a user