forked from qt-creator/qt-creator
Clang: Add unsaved files messages
We have auto generated buffers from ui files which are not open but have no file representation. So we need to provide them as unsaved files only. Change-Id: I48a426c18e06eeda2fa707864f32f293e17ac651 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
@@ -48,9 +48,11 @@
|
||||
#include <cmbunregisterprojectsforeditormessage.h>
|
||||
#include <cmbunregistertranslationunitsforeditormessage.h>
|
||||
#include <diagnosticschangedmessage.h>
|
||||
#include <registerunsavedfilesforeditormessage.h>
|
||||
#include <requestdiagnosticsmessage.h>
|
||||
#include <projectpartsdonotexistmessage.h>
|
||||
#include <translationunitdoesnotexistmessage.h>
|
||||
#include <unregisterunsavedfilesforeditormessage.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
@@ -138,6 +140,37 @@ void ClangIpcServer::unregisterProjectPartsForEditor(const UnregisterProjectPart
|
||||
}
|
||||
}
|
||||
|
||||
void ClangIpcServer::registerUnsavedFilesForEditor(const RegisterUnsavedFilesForEditorMessage &message)
|
||||
{
|
||||
TIME_SCOPE_DURATION("ClangIpcServer::registerUnsavedFilesForEditor");
|
||||
|
||||
try {
|
||||
unsavedFiles.createOrUpdate(message.fileContainers());
|
||||
translationUnits.updateTranslationUnitsWithChangedDependencies(message.fileContainers());
|
||||
sendDiagnosticsTimer.start();
|
||||
} catch (const ProjectPartDoNotExistException &exception) {
|
||||
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
|
||||
} catch (const std::exception &exception) {
|
||||
qWarning() << "Error in ClangIpcServer::registerUnsavedFilesForEditor:" << exception.what();
|
||||
}
|
||||
}
|
||||
|
||||
void ClangIpcServer::unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message)
|
||||
{
|
||||
TIME_SCOPE_DURATION("ClangIpcServer::unregisterUnsavedFilesForEditor");
|
||||
|
||||
try {
|
||||
unsavedFiles.remove(message.fileContainers());
|
||||
translationUnits.updateTranslationUnitsWithChangedDependencies(message.fileContainers());
|
||||
} catch (const TranslationUnitDoesNotExistException &exception) {
|
||||
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistMessage(exception.fileContainer()));
|
||||
} catch (const ProjectPartDoNotExistException &exception) {
|
||||
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
|
||||
} catch (const std::exception &exception) {
|
||||
qWarning() << "Error in ClangIpcServer::unregisterUnsavedFilesForEditor:" << exception.what();
|
||||
}
|
||||
}
|
||||
|
||||
void ClangIpcServer::completeCode(const ClangBackEnd::CompleteCodeMessage &message)
|
||||
{
|
||||
TIME_SCOPE_DURATION("ClangIpcServer::completeCode");
|
||||
|
||||
Reference in New Issue
Block a user