forked from qt-creator/qt-creator
Clang: Fix delayed reparse of dirty and visible but not current documents
1. Open document foo.h
2. Create a split and open foo.cpp (#including "foo.h")
3. Edit foo.h (e.g. by introducing a syntax error, so that foo.cpp will
indicate header errors in the toolbar or as info bar)
=> Actual: foo.cpp will be reparsed immediately.
Expected: foo.cpp should be reparsed after a delay.
This saves resources (cpu time) and minimizes poping up of the header
info bar while editing header files in splits.
Regression introduced by
commit 380d756a03
Clang: Hook up supportive translation unit on first edit
Change-Id: Ib5fd90e49415dfc3aefacab7cd627b0e1937f5fc
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -65,16 +65,22 @@ public: // for tests
|
||||
int queueSizeForTestsOnly();
|
||||
bool isTimerRunningForTestOnly() const;
|
||||
void setUpdateDocumentAnnotationsTimeOutInMsForTestsOnly(int value);
|
||||
void setUpdateVisibleButNotCurrentDocumentsTimeOutInMsForTestsOnly(int value);
|
||||
DocumentProcessors &documentProcessors();
|
||||
|
||||
private:
|
||||
|
||||
void startDocumentAnnotationsTimerIfFileIsNotOpenAsDocument(const Utf8String &filePath);
|
||||
void addJobRequestsForDirtyAndVisibleDocuments();
|
||||
void processJobsForDirtyAndVisibleDocuments();
|
||||
|
||||
void processInitialJobsForDocuments(const std::vector<Document> &documents);
|
||||
void startInitializingSupportiveTranslationUnits(const std::vector<Document> &documents);
|
||||
|
||||
void processJobsForDirtyAndVisibleDocuments();
|
||||
void processJobsForDirtyCurrentDocument();
|
||||
void processTimerForVisibleButNotCurrentDocuments();
|
||||
void processJobsForDirtyAndVisibleButNotCurrentDocuments();
|
||||
|
||||
void addAndRunUpdateJobs(const std::vector<Document> &documents);
|
||||
|
||||
JobRequest createJobRequest(const Document &document,
|
||||
JobRequest::Type type,
|
||||
PreferredTranslationUnit preferredTranslationUnit
|
||||
@@ -88,7 +94,10 @@ private:
|
||||
QScopedPointer<DocumentProcessors> documentProcessors_; // Delayed initialization
|
||||
|
||||
QTimer updateDocumentAnnotationsTimer;
|
||||
int updateDocumentAnnotationsTimeOutInMs;
|
||||
int updateDocumentAnnotationsTimeOutInMs = 1500;
|
||||
|
||||
QTimer updateVisibleButNotCurrentDocumentsTimer;
|
||||
int updateVisibleButNotCurrentDocumentsTimeOutInMs = 2000;
|
||||
};
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Reference in New Issue
Block a user