Clang: Stop trying to remove duplicate completion items

We assume that libclang does not return any duplicates, at least we
never noticed any so far. For the concrete test below no duplicates were
removed.

Function overloads are not problematic because they are folded into one
ClangAssistProposalItem (addOverload()).

To the completion items from libclang we add the Qt Creator snippets as
items. Those might have the same text in the completion list view, but
their icon is different (e.g. consider the keyword completion "class"
and the Qt Creator snippet "class"), thus the user can still tell them
apart.

Test:
 1. Open src/plugins/clangstaticanalyzer/unit-tests/qt-essential-includes.pro
 2. Open main.cpp
 3. Complete in the main function

Measured with a timer in IpcReceiver::codeCompleted.

On Linux, for 20637 completion items:
 Before: 74ms (avg)
    Now: 66ms (avg)
   Gain: 11%

Change-Id: I524eaa09f8d9e07c78dc9efcc77f7e021c6f37f7
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Nikolai Kosjar
2016-07-26 08:52:12 +02:00
parent ead6853b09
commit 9d5705a755
5 changed files with 15 additions and 2 deletions

View File

@@ -407,7 +407,8 @@ void GenericProposalWidget::setIsSynchronized(bool isSync)
void GenericProposalWidget::showProposal(const QString &prefix)
{
ensurePolished();
d->m_model->removeDuplicates();
if (d->m_model->containsDuplicates())
d->m_model->removeDuplicates();
if (!updateAndCheck(prefix))
return;
show();