summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor/cppcodeformatter.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2021-12-08 15:15:39 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2021-12-13 09:29:12 +0000
commit1717e0b702d963ea9ea28a8bbe4f567337af566f (patch)
tree7cbedae08131714b20ad20fd2f8585c0eade5326 /src/plugins/cppeditor/cppcodeformatter.cpp
parent613a9a13c83f07b6809415fc6ed3a50ea27186e8 (diff)
downloadqt-creator-1717e0b702d963ea9ea28a8bbe4f567337af566f.tar.gz
CppEditor: Fix indentation problem with raw string literals
Pass the necessary context information in and out of the SimpleLexer. Task-number: QTCREATORBUG-26211 Change-Id: I8063b03f4c9734991f15b5c0e7b58ee52e3cfc52 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/cppcodeformatter.cpp')
-rw-r--r--src/plugins/cppeditor/cppcodeformatter.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/cppeditor/cppcodeformatter.cpp b/src/plugins/cppeditor/cppcodeformatter.cpp
index 5ff7aa7f86..e806dab1a8 100644
--- a/src/plugins/cppeditor/cppcodeformatter.cpp
+++ b/src/plugins/cppeditor/cppcodeformatter.cpp
@@ -1084,6 +1084,8 @@ int CodeFormatter::tokenizeBlock(const QTextBlock &block, bool *endedJoined)
SimpleLexer tokenize;
tokenize.setLanguageFeatures(features);
+ tokenize.setExpectedRawStringSuffix(
+ TextDocumentLayout::expectedRawStringSuffix(block.previous()));
m_currentLine = block.text();
// to determine whether a line was joined, Tokenizer needs a
@@ -1096,6 +1098,7 @@ int CodeFormatter::tokenizeBlock(const QTextBlock &block, bool *endedJoined)
const int lexerState = tokenize.state();
TextDocumentLayout::setLexerState(block, lexerState);
+ TextDocumentLayout::setExpectedRawStringSuffix(block, tokenize.expectedRawStringSuffix());
return lexerState;
}