Commit 7bfd08e3 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Removed the completion item relevance

parent 7ee5ea0a
......@@ -492,19 +492,7 @@ void CompletionListView::setQuickFix(bool quickFix)
void CompletionListView::setCompletionItems(const QList<TextEditor::CompletionItem> &completionItems)
{
m_model->setItems(completionItems);
// Select the first of the most relevant completion items
int relevance = INT_MIN;
int mostRelevantIndex = 0;
for (int i = 0; i < completionItems.size(); ++i) {
const CompletionItem &item = completionItems.at(i);
if (item.relevance > relevance) {
relevance = item.relevance;
mostRelevantIndex = i;
}
}
setCurrentIndex(m_model->index(mostRelevantIndex));
setCurrentIndex(m_model->index(0)); // Select the first item
}
void CompletionListView::closeList(const QModelIndex &index)
......
......@@ -207,20 +207,9 @@ void ICompletionCollector::filter(const QList<TextEditor::CompletionItem> &items
}
const QRegExp regExp(keyRegExp);
const bool hasKey = !key.isEmpty();
foreach (TextEditor::CompletionItem item, items) {
if (regExp.indexIn(item.text) == 0) {
if (hasKey) {
if (item.text.startsWith(key, Qt::CaseSensitive)) {
item.relevance = 2;
} else if (caseSensitivity != TextEditor::CaseSensitive
&& item.text.startsWith(key, Qt::CaseInsensitive)) {
item.relevance = 1;
}
}
foreach (TextEditor::CompletionItem item, items)
if (regExp.indexIn(item.text) == 0)
filteredItems->append(item);
}
}
}
bool ICompletionCollector::shouldRestartCompletion()
......
......@@ -54,8 +54,7 @@ class CompletionItem
{
public:
CompletionItem(ICompletionCollector *collector = 0)
: relevance(0),
duplicateCount(0),
: duplicateCount(0),
order(0),
originalIndex(0),
collector(collector),
......@@ -69,7 +68,6 @@ public:
QString details;
QIcon icon;
QVariant data;
int relevance;
int duplicateCount;
int order;
int originalIndex;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment