Enable completion in C++ ctor-initializers. For example,

struct foo {
  int m_zoo;

  foo(): m_ // cursor is here.
This commit is contained in:
Roberto Raggi
2009-10-08 15:32:12 +02:00
parent 6bcfee4840
commit 7105b773a1

View File

@@ -640,6 +640,14 @@ static int startOfOperator(TextEditor::ITextEditable *editor,
} }
} }
if (k == T_COMMA) {
ExpressionUnderCursor expressionUnderCursor;
if (expressionUnderCursor.startOfFunctionCall(tc) == -1) {
k = T_EOF_SYMBOL;
start = pos;
}
}
static CPlusPlus::TokenUnderCursor tokenUnderCursor; static CPlusPlus::TokenUnderCursor tokenUnderCursor;
const SimpleToken tk = tokenUnderCursor(tc); const SimpleToken tk = tokenUnderCursor(tc);
@@ -783,12 +791,15 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
if (m_completionOperator == T_COMMA) { if (m_completionOperator == T_COMMA) {
tc.setPosition(endOfExpression); tc.setPosition(endOfExpression);
const int start = expressionUnderCursor.startOfFunctionCall(tc); const int start = expressionUnderCursor.startOfFunctionCall(tc);
if (start != -1) { if (start == -1) {
m_completionOperator = T_EOF_SYMBOL;
return -1;
}
endOfExpression = start; endOfExpression = start;
m_startPosition = start + 1; m_startPosition = start + 1;
m_completionOperator = T_LPAREN; m_completionOperator = T_LPAREN;
} }
}
QString expression; QString expression;
tc.setPosition(endOfExpression); tc.setPosition(endOfExpression);