Commit 1c60ae10 authored by Leandro Melo's avatar Leandro Melo Committed by Leandro T. C. Melo

Completion: Ignore non identifiers when matching proposals

Since now we reduced the idle editor time for showing completions,
some things started to be a bit annoying. This fix changes the
prefix from the proposal to include only letters, digits, and the
underscore. Yes, technically they are not allways identifiers
in a generic sense, but it should be enough for our purpose.

Now, you should not receive a proposal 'foo:' when you have already
typed 'foo' in QML, for example.

Change-Id: Ica92182a34636598faedb067d0527e37ca6fee89
Reviewed-on: default avatarRoberto Raggi <>
parent 99fee33f
......@@ -241,6 +241,14 @@ QString BasicProposalItemListModel::proposalPrefix() const
// Compute common prefix
QString firstKey = m_currentItems.first()->text();
int ignore = 0;
for (int i = firstKey.length() - 1; i >= 0; --i, ++ignore) {
const QChar &c =;
if (c.isLetterOrNumber() || c == QLatin1Char('_'))
if (ignore)
QString lastKey = m_currentItems.last()->text();
const int length = qMin(firstKey.length(), lastKey.length());
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