forked from qt-creator/qt-creator
QmlJS indenter: Never touch indent of multi-line strings.
Task-number: QTCREATORBUG-6368 Change-Id: Iae68427e429e625214bc0729aaaf313dc3371570 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
@@ -517,10 +517,10 @@ int CodeFormatter::indentForNewLineAfter(const QTextBlock &block)
|
||||
{
|
||||
restoreCurrentState(block);
|
||||
|
||||
int lexerState = loadLexerState(block);
|
||||
m_tokens.clear();
|
||||
m_currentLine.clear();
|
||||
adjustIndent(m_tokens, lexerState, &m_indentDepth);
|
||||
const int startLexerState = loadLexerState(block.previous());
|
||||
adjustIndent(m_tokens, startLexerState, &m_indentDepth);
|
||||
|
||||
return m_indentDepth;
|
||||
}
|
||||
@@ -665,10 +665,11 @@ void CodeFormatter::leave(bool statementDone)
|
||||
|
||||
void CodeFormatter::correctIndentation(const QTextBlock &block)
|
||||
{
|
||||
const int lexerState = tokenizeBlock(block);
|
||||
tokenizeBlock(block);
|
||||
Q_ASSERT(m_currentState.size() >= 1);
|
||||
|
||||
adjustIndent(m_tokens, lexerState, &m_indentDepth);
|
||||
const int startLexerState = loadLexerState(block.previous());
|
||||
adjustIndent(m_tokens, startLexerState, &m_indentDepth);
|
||||
}
|
||||
|
||||
bool CodeFormatter::tryInsideExpression(bool alsoExpression)
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void onEnter(int newState, int *indentDepth, int *savedIndentDepth) const = 0;
|
||||
virtual void adjustIndent(const QList<Token> &tokens, int lexerState, int *indentDepth) const = 0;
|
||||
virtual void adjustIndent(const QList<Token> &tokens, int startLexerState, int *indentDepth) const = 0;
|
||||
|
||||
struct State;
|
||||
class QMLJS_EXPORT BlockData
|
||||
|
||||
Reference in New Issue
Block a user