Skip to content
Snippets Groups Projects
Commit 7bafb8ad authored by Christian Kamm's avatar Christian Kamm
Browse files

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: default avatarLeandro Melo <leandro.melo@nokia.com>
parent 3029af27
No related branches found
No related tags found
No related merge requests found
...@@ -147,7 +147,7 @@ CodeAssistantPrivate::CodeAssistantPrivate(CodeAssistant *assistant) ...@@ -147,7 +147,7 @@ CodeAssistantPrivate::CodeAssistantPrivate(CodeAssistant *assistant)
, m_settings(TextEditorSettings::instance()->completionSettings()) , m_settings(TextEditorSettings::instance()->completionSettings())
{ {
m_automaticProposalTimer.setSingleShot(true); m_automaticProposalTimer.setSingleShot(true);
m_automaticProposalTimer.setInterval(250); m_automaticProposalTimer.setInterval(400);
connect(&m_automaticProposalTimer, SIGNAL(timeout()), this, SLOT(automaticProposalTimeout())); connect(&m_automaticProposalTimer, SIGNAL(timeout()), this, SLOT(automaticProposalTimeout()));
connect(TextEditorSettings::instance(), connect(TextEditorSettings::instance(),
...@@ -278,7 +278,7 @@ void CodeAssistantPrivate::proposalComputed() ...@@ -278,7 +278,7 @@ void CodeAssistantPrivate::proposalComputed()
{ {
// Since the request runner is a different thread, there's still a gap in which the queued // 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. // signal could be processed after an invalidation of the current request.
if (!m_requestRunner) if (m_requestRunner != sender())
return; return;
IAssistProposal *newProposal = m_requestRunner->proposal(); IAssistProposal *newProposal = m_requestRunner->proposal();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment