summaryrefslogtreecommitdiff
path: root/src/plugins/clangcodemodel/clangbackendipcintegration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/clangcodemodel/clangbackendipcintegration.cpp')
-rw-r--r--src/plugins/clangcodemodel/clangbackendipcintegration.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/plugins/clangcodemodel/clangbackendipcintegration.cpp b/src/plugins/clangcodemodel/clangbackendipcintegration.cpp
index d03b56b89a..3d44710072 100644
--- a/src/plugins/clangcodemodel/clangbackendipcintegration.cpp
+++ b/src/plugins/clangcodemodel/clangbackendipcintegration.cpp
@@ -145,8 +145,11 @@ void IpcReceiver::codeCompleted(const CodeCompletedCommand &command)
const quint64 ticket = command.ticketNumber();
QScopedPointer<ClangCompletionAssistProcessor> processor(m_assistProcessorsTable.take(ticket));
- if (processor)
- processor->asyncCompletionsAvailable(command.codeCompletions());
+ if (processor) {
+ const bool finished = processor->handleAvailableAsyncCompletions(command.codeCompletions());
+ if (!finished)
+ processor.take();
+ }
}
void IpcReceiver::translationUnitDoesNotExist(const TranslationUnitDoesNotExistCommand &command)
@@ -233,13 +236,10 @@ static bool areCommandsRegistered = false;
void IpcCommunicator::initializeBackend()
{
- // TODO: Add a asynchron API to ConnectionClient, otherwise we might hang here
-
if (!areCommandsRegistered) {
areCommandsRegistered = true;
Commands::registerCommands();
}
- QElapsedTimer timer; timer.start();
const QString clangBackEndProcessPath = backendProcessPath();
qCDebug(log) << "Starting" << clangBackEndProcessPath;
@@ -251,12 +251,9 @@ void IpcCommunicator::initializeBackend()
connect(&m_connection, &ConnectionClient::processRestarted,
this, &IpcCommunicator::onBackendRestarted);
- if (m_connection.connectToServer()) {
- qCDebug(log) << "...started and connected in" << timer.elapsed() << "ms.";
+ // TODO: Add a asynchron API to ConnectionClient, otherwise we might hang here
+ if (m_connection.connectToServer())
initializeBackendWithCurrentData();
- } else {
- qCDebug(log) << "...failed.";
- }
}
void IpcCommunicator::registerEmptyProjectForProjectLessFiles()
@@ -310,8 +307,7 @@ static ClangBackEnd::ProjectPartContainer toProjectPartContainer(
const CppTools::ProjectPart::Ptr &projectPart)
{
const QStringList arguments = projectPartCommandLine(projectPart);
- return ClangBackEnd::ProjectPartContainer(projectPart->projectFile,
- Utf8StringVector(arguments));
+ return ClangBackEnd::ProjectPartContainer(projectPart->id(), Utf8StringVector(arguments));
}
static QVector<ClangBackEnd::ProjectPartContainer> toProjectPartContainers(
@@ -339,13 +335,13 @@ void IpcCommunicator::updateUnsavedFileFromCppEditorDocument(const QString &file
void IpcCommunicator::updateUnsavedFile(const QString &filePath, const QByteArray &contents)
{
- const QString projectFilePath = Utils::projectFilePathForFile(filePath);
+ const QString projectPartId = Utils::projectPartIdForFile(filePath);
const bool hasUnsavedContent = true;
// TODO: Send new only if changed
registerFilesForCodeCompletion({
ClangBackEnd::FileContainer(filePath,
- projectFilePath,
+ projectPartId,
Utf8String::fromByteArray(contents),
hasUnsavedContent)
});
@@ -432,12 +428,12 @@ void IpcCommunicator::registerProjectPartsForCodeCompletion(
m_ipcSender->registerProjectPartsForCodeCompletion(command);
}
-void IpcCommunicator::unregisterProjectPartsForCodeCompletion(const QStringList &filePaths)
+void IpcCommunicator::unregisterProjectPartsForCodeCompletion(const QStringList &projectPartIds)
{
if (m_sendMode == IgnoreSendRequests)
return;
- const UnregisterProjectPartsForCodeCompletionCommand command((Utf8StringVector(filePaths)));
+ const UnregisterProjectPartsForCodeCompletionCommand command((Utf8StringVector(projectPartIds)));
qCDebug(log) << ">>>" << command;
m_ipcSender->unregisterProjectPartsForCodeCompletion(command);
}