Commit d2a07dfa authored by David Schulz's avatar David Schulz
Browse files

Editor: Fix Completion of includes triggered at '.'



Task-number: QTCREATORBUG-7522

Change-Id: I1a6c165b968fcb0a4058e91f95ca70d8b77a8970
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent fb15ae2f
......@@ -831,7 +831,8 @@ int CppCompletionAssistProcessor::startOfOperator(int pos,
else if (tk.is(T_COMMENT) || tk.is(T_CPP_COMMENT) ||
(tk.isLiteral() && (*kind != T_STRING_LITERAL
&& *kind != T_ANGLE_STRING_LITERAL
&& *kind != T_SLASH))) {
&& *kind != T_SLASH
&& *kind != T_DOT))) {
*kind = T_EOF_SYMBOL;
start = pos;
}
......@@ -858,7 +859,8 @@ int CppCompletionAssistProcessor::startOfOperator(int pos,
}
}
// Check for include preprocessor directive
else if (*kind == T_STRING_LITERAL || *kind == T_ANGLE_STRING_LITERAL || *kind == T_SLASH) {
else if (*kind == T_STRING_LITERAL || *kind == T_ANGLE_STRING_LITERAL|| *kind == T_SLASH
|| (*kind == T_DOT && (tk.is(T_STRING_LITERAL) || tk.is(T_ANGLE_STRING_LITERAL)))) {
bool include = false;
if (tokens.size() >= 3) {
if (tokens.at(0).is(T_POUND) && tokens.at(1).is(T_IDENTIFIER) && (tokens.at(2).is(T_STRING_LITERAL) ||
......@@ -877,6 +879,14 @@ int CppCompletionAssistProcessor::startOfOperator(int pos,
if (!include) {
*kind = T_EOF_SYMBOL;
start = pos;
} else {
if (*kind == T_DOT) {
start = findStartOfName(start);
const QChar ch4 = start > -1 ? m_interface->characterAt(start - 1) : QChar();
const QChar ch5 = start > 0 ? m_interface->characterAt(start - 2) : QChar();
const QChar ch6 = start > 1 ? m_interface->characterAt(start - 3) : QChar();
start = start - CppCompletionAssistProvider::activationSequenceChar(ch4, ch5, ch6, kind, wantFunctionCall);
}
}
}
}
......@@ -943,7 +953,7 @@ int CppCompletionAssistProcessor::startCompletionHelper()
QTextCursor c(m_interface->textDocument());
c.setPosition(endOfExpression);
if (completeInclude(c))
m_startPosition = startOfName;
m_startPosition = endOfExpression + 1;
return m_startPosition;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment