Made typing parenthesis even faster

Only attempt to activate the completion when there is a function id on
the left of the parenthesis.

Reviewed-by: Roberto Raggi
This commit is contained in:
Thorbjørn Lindeijer
2009-05-27 11:12:06 +02:00
parent 39b0da2a1e
commit efc0b20859
4 changed files with 36 additions and 7 deletions

View File

@@ -514,6 +514,26 @@ static int startOfOperator(TextEditor::ITextEditable *editor,
start = pos;
}
if (k == T_LPAREN) {
const QList<SimpleToken> &tokens = tokenUnderCursor.tokens();
int i = 0;
for (; i < tokens.size(); ++i) {
const SimpleToken &token = tokens.at(i);
if (token.position() == tk.position()) {
if (i == 0) // no token on the left, but might be on a previous line
break;
const SimpleToken &previousToken = tokens.at(i - 1);
if (previousToken.is(T_IDENTIFIER) || previousToken.is(T_GREATER))
break;
}
}
if (i == tokens.size()) {
k = T_EOF_SYMBOL;
start = pos;
}
}
if (kind)
*kind = k;