Completion: Fix completion not triggering sometimes.

The problem was that an automatically triggered 'idle' completion result
could come in while we were waiting for actual 'triggered' completion
and then the real completion result would be discarded.

To avoid that:
* Only accept proposals from the currently running completion.
* Increase the idle completion timeout to 400ms so it doesn't get
  triggered during regular typing.

Change-Id: Ibb2fa8907a2b67a94e092dfdc5a48fb50be06b65
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
Christian Kamm
2011-11-23 12:09:16 +01:00
parent 3029af2769
commit 7bafb8adfa

View File

@@ -147,7 +147,7 @@ CodeAssistantPrivate::CodeAssistantPrivate(CodeAssistant *assistant)
, m_settings(TextEditorSettings::instance()->completionSettings())
{
m_automaticProposalTimer.setSingleShot(true);
m_automaticProposalTimer.setInterval(250);
m_automaticProposalTimer.setInterval(400);
connect(&m_automaticProposalTimer, SIGNAL(timeout()), this, SLOT(automaticProposalTimeout()));
connect(TextEditorSettings::instance(),
@@ -278,7 +278,7 @@ void CodeAssistantPrivate::proposalComputed()
{
// Since the request runner is a different thread, there's still a gap in which the queued
// signal could be processed after an invalidation of the current request.
if (!m_requestRunner)
if (m_requestRunner != sender())
return;
IAssistProposal *newProposal = m_requestRunner->proposal();