Check the type of the token that triggered the completion.

This commit is contained in:
Roberto Raggi
2010-06-02 15:22:42 +02:00
parent ffa66f4fb5
commit 99b2020cb3

View File

@@ -634,8 +634,10 @@ int CppCodeCompletion::startPosition() const
bool CppCodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor) bool CppCodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor)
{ {
const int pos = editor->position(); const int pos = editor->position();
if (startOfOperator(editor, pos, /*token =*/ 0, /*want function call=*/ true) != pos) { unsigned token = T_EOF_SYMBOL;
if (m_completionOperator == T_POUND) {
if (startOfOperator(editor, pos, &token, /*want function call=*/ true) != pos) {
if (token == T_POUND) {
if (TextEditor::BaseTextEditor *edit = qobject_cast<TextEditor::BaseTextEditor *>(editor->widget())) { if (TextEditor::BaseTextEditor *edit = qobject_cast<TextEditor::BaseTextEditor *>(editor->widget())) {
QTextCursor tc(edit->document()); QTextCursor tc(edit->document());
tc.setPosition(pos); tc.setPosition(pos);