forked from qt-creator/qt-creator
Highlight `import' keyword.
This commit is contained in:
@@ -115,7 +115,7 @@ void QScriptHighlighter::highlightBlock(const QString &text)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Token::Identifier: {
|
case Token::Identifier: {
|
||||||
if (maybeQmlKeyword(text.midRef(token.offset, token.length))) {
|
if (m_duiEnabled && maybeQmlKeyword(text.midRef(token.offset, token.length))) {
|
||||||
// check the previous token
|
// check the previous token
|
||||||
if (index == 0 || tokens.at(index - 1).isNot(Token::Dot)) {
|
if (index == 0 || tokens.at(index - 1).isNot(Token::Dot)) {
|
||||||
if (index + 1 == tokens.size() || tokens.at(index + 1).isNot(Token::Colon)) {
|
if (index + 1 == tokens.size() || tokens.at(index + 1).isNot(Token::Colon)) {
|
||||||
@@ -241,6 +241,8 @@ bool QScriptHighlighter::maybeQmlKeyword(const QStringRef &text) const
|
|||||||
return true;
|
return true;
|
||||||
} else if (ch == QLatin1Char('r') && text == QLatin1String("readonly")) {
|
} else if (ch == QLatin1Char('r') && text == QLatin1String("readonly")) {
|
||||||
return true;
|
return true;
|
||||||
|
} else if (ch == QLatin1Char('i') && text == QLatin1String("import")) {
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user