From 3ae971be452429f6d42b07469f468543d7d4b37f Mon Sep 17 00:00:00 2001
From: Roberto Raggi <roberto.raggi@nokia.com>
Date: Tue, 3 Mar 2009 17:55:12 +0100
Subject: [PATCH] Don't look at the whole project. We're only interested in the
 symbols that we can resolve in the current file.

---
 src/plugins/cppeditor/cppeditor.cpp | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index 1ca1c9f72d9..505e97ab7d5 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -416,8 +416,11 @@ void CPPEditor::updateMethodBoxIndex()
         const QString expression = expressionUnderCursor(tc);
         //qDebug() << "expression:" << expression;
 
+        Snapshot snapshot;
+        snapshot.insert(thisDocument->fileName(), thisDocument);
+
         TypeOfExpression typeOfExpression;
-        typeOfExpression.setSnapshot(m_modelManager->snapshot());
+        typeOfExpression.setSnapshot(snapshot);
 
         const QList<TypeOfExpression::Result> results =
                 typeOfExpression(expression, thisDocument, symbol, TypeOfExpression::Preprocess);
@@ -439,6 +442,19 @@ void CPPEditor::updateMethodBoxIndex()
 
                 QTextCursor c(document()->findBlockByNumber(symbol->line() - 1));
                 c.setPosition(c.position() + column);
+
+                const QString text = c.block().text();
+
+                int i = column;
+                for (; i < text.length(); ++i) {
+                    const QChar &ch = text.at(i);
+
+                    if (ch == QLatin1Char('*') || ch == QLatin1Char('&'))
+                        c.movePosition(QTextCursor::NextCharacter);
+                    else
+                        break;
+                }
+
                 c.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
 
                 QTextEdit::ExtraSelection sel;
-- 
GitLab