forked from qt-creator/qt-creator
Clang: Make document annotations timer configurable
...by environment variable. Change-Id: If20589e84dea2366fd9b6b273259ce29eddb965b Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
@@ -66,7 +66,29 @@
|
|||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
const int delayedDocumentAnnotationsTimerInterval = 3000;
|
|
||||||
|
int getIntervalFromEnviromentVariable()
|
||||||
|
{
|
||||||
|
const QByteArray userIntervalAsByteArray = qgetenv("QTC_CLANG_DELAYED_REPARSE_TIMEOUT");
|
||||||
|
|
||||||
|
bool isConversionOk = false;
|
||||||
|
const int intervalAsInt = userIntervalAsByteArray.toInt(&isConversionOk);
|
||||||
|
|
||||||
|
if (isConversionOk)
|
||||||
|
return intervalAsInt;
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int delayedDocumentAnnotationsTimerInterval()
|
||||||
|
{
|
||||||
|
static const int defaultInterval = 3000;
|
||||||
|
static const int userDefinedInterval = getIntervalFromEnviromentVariable();
|
||||||
|
static const int interval = userDefinedInterval >= 0 ? userDefinedInterval : defaultInterval;
|
||||||
|
|
||||||
|
return interval;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClangIpcServer::ClangIpcServer()
|
ClangIpcServer::ClangIpcServer()
|
||||||
@@ -138,7 +160,7 @@ void ClangIpcServer::updateTranslationUnitsForEditor(const UpdateTranslationUnit
|
|||||||
if (newerFileContainers.size() > 0) {
|
if (newerFileContainers.size() > 0) {
|
||||||
translationUnits.update(newerFileContainers);
|
translationUnits.update(newerFileContainers);
|
||||||
unsavedFiles.createOrUpdate(newerFileContainers);
|
unsavedFiles.createOrUpdate(newerFileContainers);
|
||||||
sendDocumentAnnotationsTimer.start(delayedDocumentAnnotationsTimerInterval);
|
sendDocumentAnnotationsTimer.start(delayedDocumentAnnotationsTimerInterval());
|
||||||
}
|
}
|
||||||
} catch (const ProjectPartDoNotExistException &exception) {
|
} catch (const ProjectPartDoNotExistException &exception) {
|
||||||
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
|
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
|
||||||
@@ -196,7 +218,7 @@ void ClangIpcServer::registerUnsavedFilesForEditor(const RegisterUnsavedFilesFor
|
|||||||
try {
|
try {
|
||||||
unsavedFiles.createOrUpdate(message.fileContainers());
|
unsavedFiles.createOrUpdate(message.fileContainers());
|
||||||
translationUnits.updateTranslationUnitsWithChangedDependencies(message.fileContainers());
|
translationUnits.updateTranslationUnitsWithChangedDependencies(message.fileContainers());
|
||||||
sendDocumentAnnotationsTimer.start(delayedDocumentAnnotationsTimerInterval);
|
sendDocumentAnnotationsTimer.start(delayedDocumentAnnotationsTimerInterval());
|
||||||
} catch (const ProjectPartDoNotExistException &exception) {
|
} catch (const ProjectPartDoNotExistException &exception) {
|
||||||
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
|
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
|
||||||
} catch (const std::exception &exception) {
|
} catch (const std::exception &exception) {
|
||||||
|
Reference in New Issue
Block a user