CodeCompletionWorker refactored

Niko Sams niko.sams at gmail.com
Sat Jan 31 18:18:58 UTC 2009


Hi David, Hi list,

I'd like moved some some parts that are equal in Cpp and Php language
support into
kdevplatform.
Please review the patch.

thanks,
Niko
-------------- next part --------------
Index: kdevplatform-trunk/language/codecompletion/codecompletioncontext.h
===================================================================
--- kdevplatform-trunk/language/codecompletion/codecompletioncontext.h	(Revision 918228)
+++ kdevplatform-trunk/language/codecompletion/codecompletioncontext.h	(Arbeitskopie)
@@ -33,6 +33,7 @@
 namespace KDevelop {
   class DUContext;
   class AbstractType;
+  class SimpleCursor;
 
 
   class CompletionTreeItem;
@@ -60,7 +61,12 @@
 
       ///@return depth of the context. The basic completion-context has depth 0, its parent 1, and so on..
       int depth() const;
-      
+
+      ///Computes the full set of completion items, using the information retrieved earlier.
+      ///Should only be called on the first context, parent contexts are included in the computations.
+      ///@param Abort is checked regularly, and if it is false, the computation is aborted.
+      virtual QList<KDevelop::CompletionTreeItemPointer> completionItems(const KDevelop::SimpleCursor& position, bool& abort, bool fullCompletion = true) = 0;
+
       /**In the case of recursive argument-hints, there may be a chain of parent-contexts, each for the higher argument-matching
        * The parentContext() should always have the access-operation FunctionCallAccess.
        * When a completion-list is computed, the members of the list can be highlighted that match the corresponding parentContext()->functions() function-argument, or parentContext()->additionalMatchTypes()
Index: kdevplatform-trunk/language/codecompletion/codecompletionworker.cpp
===================================================================
--- kdevplatform-trunk/language/codecompletion/codecompletionworker.cpp	(Revision 918228)
+++ kdevplatform-trunk/language/codecompletion/codecompletionworker.cpp	(Arbeitskopie)
@@ -29,14 +29,19 @@
 #include <klocale.h>
 
 #include "../duchain/ducontext.h"
+#include "../duchain/duchainlock.h"
+#include "../duchain/duchain.h"
 #include "codecompletion.h"
 #include "codecompletionitem.h"
+#include "codecompletionmodel.h"
+#include "codecompletionitemgrouper.h"
 
 using namespace KTextEditor;
 using namespace KDevelop;
 
 CodeCompletionWorker::CodeCompletionWorker(QObject* parent) :
-  m_mutex(new QMutex())
+    QObject(parent)
+  , m_mutex(new QMutex())
   , m_abort(false)
   , m_fullCompletion(true)
 {
@@ -90,6 +95,55 @@
   computeCompletions(context, position, view, range, text);
 }
 
+void CodeCompletionWorker::computeCompletions(KDevelop::DUContextPointer context, const KTextEditor::Cursor& position, KTextEditor::View* view, const KTextEditor::Range& contextRange, const QString& contextText)
+{
+  KTextEditor::Cursor cursorPosition = view->cursorPosition();
+  QString followingText; //followingText may contain additional text that stands for the current item. For example in the case "QString|", QString is in addedText.
+  if(position < cursorPosition)
+    followingText = view->document()->text( KTextEditor::Range( position, cursorPosition ) );
+  
+  kDebug() << "added text:" << followingText;
+  
+  CodeCompletionContext::Ptr completionContext( createCompletionContext( context, contextText, followingText ) );
+  if (KDevelop::CodeCompletionModel* m = model())
+    m->setCompletionContext(KDevelop::CodeCompletionContext::Ptr::staticCast(completionContext));
+
+  if( completionContext->isValid() ) {
+    DUChainReadLocker lock(DUChain::lock());
+
+    if (!context) {
+      kDebug() << "Completion context disappeared before completions could be calculated";
+      return;
+    }
+    QList<CompletionTreeItemPointer> items = completionContext->completionItems(SimpleCursor(position), aborting(), fullCompletion());
+
+    if (aborting())
+      return;
+    
+    QList<KSharedPtr<CompletionTreeElement> > tree = computeGroups( items, completionContext );
+
+    if(aborting())
+      return;
+
+    emit foundDeclarations( tree, KSharedPtr<KDevelop::CodeCompletionContext>::staticCast(completionContext) );
+
+  } else {
+    kDebug() << "setContext: Invalid code-completion context";
+  }
+}
+
+QList<KSharedPtr<CompletionTreeElement> > CodeCompletionWorker::computeGroups(QList<CompletionTreeItemPointer> items, KSharedPtr<CodeCompletionContext> completionContext)
+{
+  QList<KSharedPtr<CompletionTreeElement> > tree;
+  /**
+   * 1. Group by argument-hint depth
+   * 2. Group by inheritance depth
+   * 3. Group by simplified attributes
+   * */
+  CodeCompletionItemGrouper<ArgumentHintDepthExtractor, CodeCompletionItemGrouper<InheritanceDepthExtractor, CodeCompletionItemGrouper<SimplifiedAttributesExtractor> > > argumentHintDepthGrouper(tree, 0, items);
+  return tree;
+}
+
 void CodeCompletionWorker::abortCurrentCompletion()
 {
   QMutexLocker lock(m_mutex);
@@ -101,4 +155,9 @@
   return m_abort;
 }
 
+KDevelop::CodeCompletionModel* CodeCompletionWorker::model() const
+{
+  return const_cast<KDevelop::CodeCompletionModel*>(static_cast<const KDevelop::CodeCompletionModel*>(parent()));
+}
+
 #include "codecompletionworker.moc"
Index: kdevplatform-trunk/language/codecompletion/codecompletionitem.cpp
===================================================================
--- kdevplatform-trunk/language/codecompletion/codecompletionitem.cpp	(Revision 918228)
+++ kdevplatform-trunk/language/codecompletion/codecompletionitem.cpp	(Arbeitskopie)
@@ -123,6 +123,14 @@
   return 0;
 }
 
+KTextEditor::CodeCompletionModel::CompletionProperties CompletionTreeItem::completionProperties() const {
+  Declaration* dec = declaration().data();
+  if(!dec)
+    return (KTextEditor::CodeCompletionModel::CompletionProperties)0;
+
+  return DUChainUtils::completionProperties(dec);
+}
+
 DeclarationPointer CompletionTreeItem::declaration() const {
   return DeclarationPointer();
 }
Index: kdevplatform-trunk/language/codecompletion/codecompletionworker.h
===================================================================
--- kdevplatform-trunk/language/codecompletion/codecompletionworker.h	(Revision 918228)
+++ kdevplatform-trunk/language/codecompletion/codecompletionworker.h	(Arbeitskopie)
@@ -45,8 +45,8 @@
 {
 
 class CodeCompletion;
-
 class CompletionTreeElement;
+class CodeCompletionModel;
 
 
 class KDEVPLATFORMLANGUAGE_EXPORT CodeCompletionWorker : public QObject
@@ -62,12 +62,16 @@
     void setFullCompletion(bool);
     bool fullCompletion() const;
 
+    KDevelop::CodeCompletionModel* model() const;
+
   Q_SIGNALS:
     void foundDeclarations(QList<KSharedPtr<CompletionTreeElement> >, KSharedPtr<CodeCompletionContext> completionContext);
 
   protected:
     
-    virtual void computeCompletions(DUContextPointer context, const KTextEditor::Cursor& position, KTextEditor::View* view, const KTextEditor::Range& contextRange, const QString& contextText) = 0;
+    virtual void computeCompletions(DUContextPointer context, const KTextEditor::Cursor& position, KTextEditor::View* view, const KTextEditor::Range& contextRange, const QString& contextText);
+    virtual QList<KSharedPtr<CompletionTreeElement> > computeGroups(QList<CompletionTreeItemPointer> items, KSharedPtr<CodeCompletionContext> completionContext);
+    virtual KDevelop::CodeCompletionContext* createCompletionContext(KDevelop::DUContextPointer context, const QString &contextText, const QString &followingText) const = 0;
 
     bool& aborting();
     
Index: kdevplatform-trunk/language/codecompletion/codecompletionitemgrouper.cpp
===================================================================
--- kdevplatform-trunk/language/codecompletion/codecompletionitemgrouper.cpp	(Revision 0)
+++ kdevplatform-trunk/language/codecompletion/codecompletionitemgrouper.cpp	(Revision 0)
@@ -0,0 +1,29 @@
+/*
+ * KDevelop Generic Code Completion Support
+ *
+ * Copyright 2006-2008 Hamish Rodda <rodda at kde.org>
+ * Copyright 2007-2008 David Nolden <david.nolden.kdevelop at art-master.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "codecompletionitemgrouper.h"
+
+using namespace KDevelop;
+
+///@todo make configurable. These are the attributes that can be respected for grouping.
+int SimplifiedAttributesExtractor::groupingProperties = CodeCompletionModel::Public | CodeCompletionModel::Protected | CodeCompletionModel::Private | CodeCompletionModel::Static | CodeCompletionModel::TypeAlias | CodeCompletionModel::Variable | CodeCompletionModel::Class | CodeCompletionModel::GlobalScope | CodeCompletionModel::LocalScope | CodeCompletionModel::GlobalScope | CodeCompletionModel::NamespaceScope;
+
Index: kdevplatform-trunk/language/codecompletion/codecompletionitem.h
===================================================================
--- kdevplatform-trunk/language/codecompletion/codecompletionitem.h	(Revision 918228)
+++ kdevplatform-trunk/language/codecompletion/codecompletionitem.h	(Arbeitskopie)
@@ -108,7 +108,10 @@
   virtual int inheritanceDepth() const;
   ///Should return the argument-hint depth. The completion-items don't need to return it through the data() function.
   virtual int argumentHintDepth() const;
-  
+
+  ///The default-implementation calls DUChainUtils::completionProperties
+  virtual KTextEditor::CodeCompletionModel::CompletionProperties completionProperties() const;
+
   ///If this item represents a Declaration, this should return the declaration.
   ///The default-implementation returns zero.
   virtual DeclarationPointer declaration() const;
Index: kdevplatform-trunk/language/codecompletion/codecompletionitemgrouper.h
===================================================================
--- kdevplatform-trunk/language/codecompletion/codecompletionitemgrouper.h	(Revision 0)
+++ kdevplatform-trunk/language/codecompletion/codecompletionitemgrouper.h	(Revision 0)
@@ -0,0 +1,109 @@
+/*
+ * KDevelop Generic Code Completion Support
+ *
+ * Copyright 2006-2008 Hamish Rodda <rodda at kde.org>
+ * Copyright 2007-2008 David Nolden <david.nolden.kdevelop at art-master.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KDEV_CODECOMPLETIONITEMGROUPER_H
+#define KDEV_CODECOMPLETIONITEMGROUPER_H
+
+#include "codecompletionmodel.h"
+#include "codecompletionitem.h"
+
+namespace KDevelop {
+
+///Always the last item of a grouping chain: Only inserts the items
+struct CodeCompletionItemLastGrouper {
+  CodeCompletionItemLastGrouper(QList<KSharedPtr<CompletionTreeElement> >& tree, CompletionTreeNode* parent, QList<CompletionTreeItemPointer> items)
+  {
+    foreach( CompletionTreeItemPointer item, items ) {
+      item->setParent(parent);
+      tree << KSharedPtr<CompletionTreeElement>( item.data() );
+    }
+  }
+};
+
+///Helper class that helps us grouping the completion-list. A chain of groupers can be built, by using NextGrouper.
+template<class KeyExtractor, class NextGrouper = CodeCompletionItemLastGrouper>
+struct CodeCompletionItemGrouper {
+  typedef typename KeyExtractor::KeyType KeyType;
+
+  CodeCompletionItemGrouper(QList<KSharedPtr<CompletionTreeElement> >& tree, CompletionTreeNode* parent, QList<CompletionTreeItemPointer> items)
+  {
+    typedef QMap<KeyType, QList<CompletionTreeItemPointer> > GroupMap;
+    GroupMap groups;
+
+    foreach(const CompletionTreeItemPointer& item, items) {
+      KeyType key = KeyExtractor::extract(item);
+      typename GroupMap::iterator it = groups.find(key);
+      if(it == groups.end())
+        it = groups.insert(key, QList<CompletionTreeItemPointer>());
+
+      (*it).append(item);
+    }
+
+    for( typename GroupMap::const_iterator it = groups.begin(); it != groups.end(); ++it ) {
+      KSharedPtr<CompletionTreeNode> node(new CompletionTreeNode());
+      node->setParent(parent);
+      node->role = (KTextEditor::CodeCompletionModel::ExtraItemDataRoles)KeyExtractor::Role;
+      node->roleValue = QVariant(it.key());
+
+      tree << KSharedPtr<CompletionTreeElement>( node.data() );
+      
+      NextGrouper nextGrouper(node->children, node.data(), *it);
+    }
+  }
+};
+
+///Extracts the argument-hint depth from completion-items, to be used in ItemGrouper for grouping by argument-hint depth.
+struct ArgumentHintDepthExtractor {
+  typedef int KeyType;
+  enum { Role = KTextEditor::CodeCompletionModel::ArgumentHintDepth };
+  
+  static KeyType extract( const CompletionTreeItemPointer& item ) {
+    return item->argumentHintDepth();
+  }
+};
+
+struct InheritanceDepthExtractor {
+  typedef int KeyType;
+  
+  enum { Role = KTextEditor::CodeCompletionModel::InheritanceDepth };
+  
+  static KeyType extract( const CompletionTreeItemPointer& item ) {
+    return item->inheritanceDepth();
+  }
+};
+
+struct SimplifiedAttributesExtractor {
+  typedef int KeyType;
+  
+  enum { Role = KTextEditor::CodeCompletionModel::CompletionRole };
+
+  static int groupingProperties;
+  
+  static KeyType extract( const CompletionTreeItemPointer& item ) {
+      return item->completionProperties() & groupingProperties;
+  }
+};
+
+
+}
+
+#endif // KDEV_CODECOMPLETIONITEMGROUPER_H
Index: kdevplatform-trunk/language/CMakeLists.txt
===================================================================
--- kdevplatform-trunk/language/CMakeLists.txt	(Revision 918228)
+++ kdevplatform-trunk/language/CMakeLists.txt	(Arbeitskopie)
@@ -92,6 +92,7 @@
     codecompletion/codecompletionmodel.cpp
     codecompletion/codecompletionitem.cpp
     codecompletion/codecompletioncontext.cpp
+    codecompletion/codecompletionitemgrouper.cpp
 
     codegen/createclass.cpp
     codegen/codegenerator.cpp
@@ -263,6 +264,7 @@
     codecompletion/codecompletionmodel.h
     codecompletion/codecompletionitem.h
     codecompletion/codecompletioncontext.h
+    codecompletion/codecompletionitemgrouper.h
     DESTINATION ${INCLUDE_INSTALL_DIR}/kdevplatform/language/codecompletion COMPONENT Devel
 )
 
Index: kdevelop-trunk/plugins/languages/cpp/cppcodecompletionworker.h
===================================================================
--- kdevelop-trunk/plugins/languages/cpp/cppcodecompletionworker.h	(Revision 919313)
+++ kdevelop-trunk/plugins/languages/cpp/cppcodecompletionworker.h	(Arbeitskopie)
@@ -38,6 +38,7 @@
 
   protected:
     virtual void computeCompletions(KDevelop::DUContextPointer context, const KTextEditor::Cursor& position, KTextEditor::View* view, const KTextEditor::Range& contextRange, const QString& contextText);
+    virtual KDevelop::CodeCompletionContext* createCompletionContext(KDevelop::DUContextPointer context, const QString &contextText, const QString &followingText) const;
 
   private:
     void computeGroups(QList<KDevelop::CompletionTreeItemPointer> items, KSharedPtr<Cpp::CodeCompletionContext> completionContext);
Index: kdevelop-trunk/plugins/languages/cpp/completionitem.h
===================================================================
--- kdevelop-trunk/plugins/languages/cpp/completionitem.h	(Revision 919313)
+++ kdevelop-trunk/plugins/languages/cpp/completionitem.h	(Arbeitskopie)
@@ -72,7 +72,7 @@
   //If this is not -1, it can be a fixed match-quality from 0 to 10, that will be used non-dynamically.
   int m_fixedMatchQuality;
   
-  KTextEditor::CodeCompletionModel::CompletionProperties completionProperties() const;
+  virtual KTextEditor::CodeCompletionModel::CompletionProperties completionProperties() const;
   
   virtual KDevelop::DeclarationPointer declaration() const {
     return m_declaration;
Index: kdevelop-trunk/plugins/languages/cpp/cppcodecompletionworker.cpp
===================================================================
--- kdevelop-trunk/plugins/languages/cpp/cppcodecompletionworker.cpp	(Revision 919313)
+++ kdevelop-trunk/plugins/languages/cpp/cppcodecompletionworker.cpp	(Arbeitskopie)
@@ -49,6 +49,10 @@
   : CodeCompletionWorker(parent)
 {
 }
+KDevelop::CodeCompletionContext* CppCodeCompletionWorker::createCompletionContext(KDevelop::DUContextPointer context, const QString &contextText, const QString &followingText) const
+{
+  return new Cpp::CodeCompletionContext( context, contextText, followingText );
+}
 
 void CppCodeCompletionWorker::computeCompletions(KDevelop::DUContextPointer context, const KTextEditor::Cursor& position, KTextEditor::View* view, const KTextEditor::Range& contextRange, const QString& contextText)
 {
@@ -62,135 +66,10 @@
   //We will have some caching in TopDUContext until this objects lifetime is over
   TopDUContext::Cache cache(topContext);
   Cpp::TypeConversionCacheEnabler enableConversionCache;
-  
-  KTextEditor::Cursor cursorPosition = view->cursorPosition();
-  QString followingText; //followingText may contain additional text that stands for the current item. For example in the case "QString|", QString is in addedText.
-  if(position < cursorPosition)
-    followingText = view->document()->text( KTextEditor::Range( position, cursorPosition ) );
-  
-  kDebug() << "added text:" << followingText;
-  
-  Cpp::CodeCompletionContext::Ptr completionContext( new Cpp::CodeCompletionContext( context, contextText, followingText ) );
-  if (CppCodeCompletionModel* m = model())
-    m->setCompletionContext(KDevelop::CodeCompletionContext::Ptr::staticCast(completionContext));
 
-  if( completionContext->isValid() ) {
-    DUChainReadLocker lock(DUChain::lock());
-
-    if (!context) {
-      kDebug(9007) << "Completion context disappeared before completions could be calculated";
-      return;
-    }
-
-    QList<CompletionTreeItemPointer> items = completionContext->completionItems(SimpleCursor(position), aborting(), fullCompletion());
-
-    if (aborting())
-      return;
-    
-    computeGroups( items, completionContext );
-
-  } else {
-    kDebug(9007) << "setContext: Invalid code-completion context";
-  }
+  CodeCompletionWorker::computeCompletions(context, position, view, contextRange, contextText);
 }
 
-///Always the last item of a grouping chain: Only inserts the items
-struct LastGrouper {
-  LastGrouper(QList<KSharedPtr<CompletionTreeElement> >& tree, CompletionTreeNode* parent, QList<CompletionTreeItemPointer> items)
-  {
-    foreach( CompletionTreeItemPointer item, items ) {
-      item->setParent(parent);
-      tree << KSharedPtr<CompletionTreeElement>( item.data() );
-    }
-  }
-};
-
-///Helper class that helps us grouping the completion-list. A chain of groupers can be built, by using NextGrouper.
-template<class KeyExtractor, class NextGrouper = LastGrouper>
-struct ItemGrouper {
-  typedef typename KeyExtractor::KeyType KeyType;
-  
-  ItemGrouper(QList<KSharedPtr<CompletionTreeElement> >& tree, CompletionTreeNode* parent, QList<CompletionTreeItemPointer> items)
-  {
-    typedef QMap<KeyType, QList<CompletionTreeItemPointer> > GroupMap;
-    GroupMap groups;
-    
-    foreach(const CompletionTreeItemPointer& item, items) {
-      KeyType key = KeyExtractor::extract(item);
-      typename GroupMap::iterator it = groups.find(key);
-      if(it == groups.end())
-        it = groups.insert(key, QList<CompletionTreeItemPointer>());
-
-      (*it).append(item);
-    }
-
-    for( typename GroupMap::const_iterator it = groups.begin(); it != groups.end(); ++it ) {
-      KSharedPtr<CompletionTreeNode> node(new CompletionTreeNode());
-      node->setParent(parent);
-      node->role = (KTextEditor::CodeCompletionModel::ExtraItemDataRoles)KeyExtractor::Role;
-      node->roleValue = QVariant(it.key());
-
-      tree << KSharedPtr<CompletionTreeElement>( node.data() );
-      
-      NextGrouper nextGrouper(node->children, node.data(), *it);
-    }
-  }
-};
-
-///Extracts the argument-hint depth from completion-items, to be used in ItemGrouper for grouping by argument-hint depth.
-struct ArgumentHintDepthExtractor {
-  typedef int KeyType;
-  enum { Role = KTextEditor::CodeCompletionModel::ArgumentHintDepth };
-  
-  static KeyType extract( const CompletionTreeItemPointer& item ) {
-    return item->argumentHintDepth();
-  }
-};
-
-struct InheritanceDepthExtractor {
-  typedef int KeyType;
-  
-  enum { Role = KTextEditor::CodeCompletionModel::InheritanceDepth };
-  
-  static KeyType extract( const CompletionTreeItemPointer& item ) {
-    return item->inheritanceDepth();
-  }
-};
-
-struct SimplifiedAttributesExtractor {
-  typedef int KeyType;
-  
-  enum { Role = KTextEditor::CodeCompletionModel::CompletionRole };
-
-  static int groupingProperties;
-  
-  static KeyType extract( const CompletionTreeItemPointer& item ) {
-    const NormalDeclarationCompletionItem* decItem = item->asItem<NormalDeclarationCompletionItem>();
-    if( decItem )
-      return decItem->completionProperties() & groupingProperties;
-    else
-      return 0;
-  }
-};
-
-///@todo make configurable. These are the attributes that can be respected for grouping.
-int SimplifiedAttributesExtractor::groupingProperties = CodeCompletionModel::Public | CodeCompletionModel::Protected | CodeCompletionModel::Private | CodeCompletionModel::Static | CodeCompletionModel::TypeAlias | CodeCompletionModel::Variable | CodeCompletionModel::Class | CodeCompletionModel::GlobalScope | CodeCompletionModel::LocalScope | CodeCompletionModel::GlobalScope | CodeCompletionModel::NamespaceScope;
-
-void CppCodeCompletionWorker::computeGroups(QList<CompletionTreeItemPointer> items, KSharedPtr<Cpp::CodeCompletionContext> completionContext)
-{
-  kDebug(9007) << "grouping" << items.count() << "completion-items";
-  QList<KSharedPtr<CompletionTreeElement> > tree;
-  /**
-   * 1. Group by argument-hint depth
-   * 2. Group by inheritance depth
-   * 3. Group by simplified attributes
-   * */
-  ItemGrouper<ArgumentHintDepthExtractor, ItemGrouper<InheritanceDepthExtractor, ItemGrouper<SimplifiedAttributesExtractor> > > argumentHintDepthGrouper(tree, 0, items);
-  if(aborting())
-    return;
-  emit foundDeclarations( tree, KSharedPtr<KDevelop::CodeCompletionContext>::staticCast(completionContext) );
-}
-
 CppCodeCompletionModel* CppCodeCompletionWorker::model() const
 {
   return const_cast<CppCodeCompletionModel*>(static_cast<const CppCodeCompletionModel*>(parent()));
Index: kdevelop-trunk/plugins/languages/cpp/codecompletioncontext.h
===================================================================
--- kdevelop-trunk/plugins/languages/cpp/codecompletioncontext.h	(Revision 919313)
+++ kdevelop-trunk/plugins/languages/cpp/codecompletioncontext.h	(Arbeitskopie)
@@ -56,7 +56,7 @@
       ///Computes the full set of completion items, using the information retrieved earlier.
       ///Should only be called on the first context, parent contexts are included in the computations.
       ///@param Abort is checked regularly, and if it is false, the computation is aborted.
-      QList<CompletionTreeItemPointer> completionItems(const KDevelop::SimpleCursor& position, bool& abort, bool fullCompletion = true);
+      virtual QList<CompletionTreeItemPointer> completionItems(const KDevelop::SimpleCursor& position, bool& abort, bool fullCompletion = true);
 
       typedef KSharedPtr<CodeCompletionContext> Ptr;
 


More information about the KDevelop-devel mailing list