CodeAssist: Support asynchronous processing without threads

This is required for the CodemodelBackendIPC integration in the
ClangCodeModelPlugin. Since the heavy calculation happens in a separate
process, we only need to send appropriate requests and receive results
for a working completion. However, the CodeAssist API does not fit here
since it only provides means of caculating the results in the main
thread or a worker thread. We can't use the worker thread approach since
that would lead to threading issues regarding QLocalSocket in
CodemodelBackendIPC.

IAssistProcessor::setAsyncProposalAvailable() will hand the results
back to CodeAssist in order to display them.

Change-Id: I496192560fb406ec40fa8bcb7904f7a03d2eef50
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
Nikolai Kosjar
2015-04-30 11:58:20 +02:00
parent 7050f78b8d
commit e661a9c19e
14 changed files with 87 additions and 26 deletions

View File

@@ -47,6 +47,18 @@ IAssistProcessor::IAssistProcessor()
IAssistProcessor::~IAssistProcessor()
{}
void IAssistProcessor::setAsyncProposalAvailable(IAssistProposal *proposal)
{
if (m_asyncCompletionsAvailableHandler)
m_asyncCompletionsAvailableHandler(proposal);
}
void IAssistProcessor::setAsyncCompletionAvailableHandler(
const IAssistProcessor::AsyncCompletionsAvailableHandler &finalizer)
{
m_asyncCompletionsAvailableHandler = finalizer;
}
/*!
\fn IAssistProposal *TextEditor::IAssistProcessor::perform(const AssistInterface *interface)