diff options
author | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2019-01-28 08:11:20 +0100 |
---|---|---|
committer | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2019-01-31 10:25:18 +0000 |
commit | 1dee275f58e9f9df2e2719325157cfdec42fe1cf (patch) | |
tree | b5d3480d9484a9d0347de6d3d8219f31d70b602e /src/plugins/qmljstools/qmljsindenter.cpp | |
parent | 80fb0178fdd9ee82acfb22aa512c7514868e89d1 (diff) | |
download | qt-creator-1dee275f58e9f9df2e2719325157cfdec42fe1cf.tar.gz |
ClangFormat: Add cursor position to the indenter interface
Sometimes it's imnportant where the cursor currently is
to properly format the code without affecting the current line.
Change-Id: I8b1fb11d2303adb5f960c7cb80a0ed2e6e45010f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Diffstat (limited to 'src/plugins/qmljstools/qmljsindenter.cpp')
-rw-r--r-- | src/plugins/qmljstools/qmljsindenter.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/plugins/qmljstools/qmljsindenter.cpp b/src/plugins/qmljstools/qmljsindenter.cpp index 3e156d756e..ce6f18eca9 100644 --- a/src/plugins/qmljstools/qmljsindenter.cpp +++ b/src/plugins/qmljstools/qmljsindenter.cpp @@ -53,7 +53,8 @@ bool Indenter::isElectricCharacter(const QChar &ch) const void Indenter::indentBlock(const QTextBlock &block, const QChar &typedChar, - const TextEditor::TabSettings &tabSettings) + const TextEditor::TabSettings &tabSettings, + int /*cursorPositionInEditor*/) { const int depth = indentFor(block, tabSettings); if (depth == -1) @@ -79,7 +80,9 @@ void Indenter::invalidateCache() codeFormatter.invalidateCache(m_doc); } -int Indenter::indentFor(const QTextBlock &block, const TextEditor::TabSettings &tabSettings) +int Indenter::indentFor(const QTextBlock &block, + const TextEditor::TabSettings &tabSettings, + int /*cursorPositionInEditor*/) { QmlJSTools::CreatorCodeFormatter codeFormatter(tabSettings); codeFormatter.updateStateUntil(block); @@ -87,7 +90,9 @@ int Indenter::indentFor(const QTextBlock &block, const TextEditor::TabSettings & } TextEditor::IndentationForBlock Indenter::indentationForBlocks( - const QVector<QTextBlock> &blocks, const TextEditor::TabSettings &tabSettings) + const QVector<QTextBlock> &blocks, + const TextEditor::TabSettings &tabSettings, + int /*cursorPositionInEditor*/) { QmlJSTools::CreatorCodeFormatter codeFormatter(tabSettings); |