Commit d078c31b authored by Fawzi Mohamed's avatar Fawzi Mohamed
Browse files

qmljseditor: do not complete private properties



Private properties (starting with __) are not offered as completion
unless one has already typed __*

Change-log: [Qml/JS Support] Do not show properties starting with "__" in auto-completion.

Change-Id: Iecf4c2ee5c14f12a45a26479328862d6a50b3ffb
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent 234b4bd9
......@@ -974,6 +974,19 @@ struct QmlJSLessThan
// -------------------------
// QmlJSAssistProposalModel
// -------------------------
void QmlJSAssistProposalModel::filter(const QString &prefix)
{
BasicProposalItemListModel::filter(prefix);
if (prefix.startsWith(QLatin1String("__")))
return;
QList<BasicProposalItem *> newCurrentItems;
newCurrentItems.reserve(m_currentItems.size());
foreach (BasicProposalItem *item, m_currentItems)
if (!item->text().startsWith(QLatin1String("__")))
newCurrentItems << item;
m_currentItems = newCurrentItems;
}
void QmlJSAssistProposalModel::sort()
{
qSort(currentItems().first, currentItems().second, QmlJSLessThan());
......
......@@ -69,6 +69,7 @@ public:
: TextEditor::BasicProposalItemListModel(items)
{}
virtual void filter(const QString &prefix);
virtual void sort();
virtual bool keepPerfectMatch(TextEditor::AssistReason reason) const;
};
......
......@@ -121,8 +121,8 @@ BasicProposalItemListModel::BasicProposalItemListModel()
{}
BasicProposalItemListModel::BasicProposalItemListModel(const QList<BasicProposalItem *> &items)
: m_originalItems(items)
, m_currentItems(items)
: m_currentItems(items)
, m_originalItems(items)
{
mapPersistentIds();
}
......
......@@ -69,13 +69,13 @@ public:
protected:
typedef QList<BasicProposalItem *>::iterator ItemIterator;
QPair<ItemIterator, ItemIterator> currentItems();
QList<BasicProposalItem *> m_currentItems;
private:
void mapPersistentIds();
QHash<QString, int> m_idByText;
QList<BasicProposalItem *> m_originalItems;
QList<BasicProposalItem *> m_currentItems;
};
} // TextEditor
......
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