forked from qt-creator/qt-creator
Search for `complete' expressions followed by a T_COMMA
As a side-effect, we can finally complete things like connect(&a, SIGNAL(
This commit is contained in:
@@ -45,8 +45,33 @@ ExpressionUnderCursor::~ExpressionUnderCursor()
|
||||
|
||||
int ExpressionUnderCursor::startOfExpression(BackwardsScanner &tk, int index)
|
||||
{
|
||||
// tk is a reference to a const QList. So, don't worry about [] access.
|
||||
// ### TODO implement multiline support. It should be pretty easy.
|
||||
index = startOfExpression_helper(tk, index);
|
||||
|
||||
if (_jumpedComma) {
|
||||
const SimpleToken &tok = tk[index - 1];
|
||||
|
||||
switch (tok.kind()) {
|
||||
case T_LPAREN:
|
||||
case T_LBRACKET:
|
||||
case T_LBRACE:
|
||||
case T_SEMICOLON:
|
||||
case T_COLON:
|
||||
case T_QUESTION:
|
||||
break;
|
||||
|
||||
default:
|
||||
if (tok.isOperator())
|
||||
return startOfExpression(tk, index - 1);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
int ExpressionUnderCursor::startOfExpression_helper(BackwardsScanner &tk, int index)
|
||||
{
|
||||
if (tk[index - 1].isLiteral()) {
|
||||
return index - 1;
|
||||
} else if (tk[index - 1].is(T_THIS)) {
|
||||
|
@@ -55,6 +55,7 @@ public:
|
||||
|
||||
private:
|
||||
int startOfExpression(BackwardsScanner &tk, int index);
|
||||
int startOfExpression_helper(BackwardsScanner &tk, int index);
|
||||
int previousBlockState(const QTextBlock &block);
|
||||
bool isAccessToken(const SimpleToken &tk);
|
||||
|
||||
|
Reference in New Issue
Block a user