forked from qt-creator/qt-creator
		
	CppTools: Do not block GUI thread for completions
The GUI was blocked while waiting for the parsed document. Now the blocking operation is executed in the completion thread. Task-number: QTCREATORBUG-11037 Task-number: QTCREATORBUG-11433 Change-Id: Ia7c1b1b7eea0ba75010ff667ba05273c62c18491 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
		| @@ -28,10 +28,13 @@ | ||||
| ****************************************************************************/ | ||||
|  | ||||
| #include "cppcompletionassist.h" | ||||
|  | ||||
| #include "cppdoxygen.h" | ||||
| #include "cppmodelmanager.h" | ||||
| #include "cppmodelmanagerinterface.h" | ||||
| #include "cppsnapshotupdater.h" | ||||
| #include "cpptoolsconstants.h" | ||||
| #include "cpptoolseditorsupport.h" | ||||
| #include "cppdoxygen.h" | ||||
|  | ||||
| #include <coreplugin/icore.h> | ||||
| #include <cppeditor/cppeditorconstants.h> | ||||
| @@ -422,24 +425,9 @@ TextEditor::IAssistInterface *InternalCompletionAssistProvider::createAssistInte | ||||
|         int position, TextEditor::AssistReason reason) const | ||||
| { | ||||
|     Q_UNUSED(project); | ||||
|  | ||||
|     CppModelManagerInterface *modelManager = CppModelManagerInterface::instance(); | ||||
|  | ||||
|     if (CppEditorSupport *supp = modelManager->cppEditorSupport(editor)) { | ||||
|         if (QSharedPointer<SnapshotUpdater> updater = supp->snapshotUpdater()) { | ||||
|             updater->update(modelManager->workingCopy()); | ||||
|             return new CppTools::Internal::CppCompletionAssistInterface( | ||||
|                         document, | ||||
|                         position, | ||||
|                         editor->document()->filePath(), | ||||
|                         reason, | ||||
|                         updater->snapshot(), | ||||
|                         updater->includePaths(), | ||||
|                         updater->frameworkPaths()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     return 0; | ||||
|     QTC_ASSERT(editor, return 0); | ||||
|     QTC_ASSERT(document, return 0); | ||||
|     return new CppTools::Internal::CppCompletionAssistInterface(editor, document, position, reason); | ||||
| } | ||||
|  | ||||
| // ----------------- | ||||
| @@ -1930,3 +1918,20 @@ bool CppCompletionAssistProcessor::completeConstructorOrFunction(const QList<CPl | ||||
|  | ||||
|     return false; | ||||
| } | ||||
|  | ||||
| void CppCompletionAssistInterface::getCppSpecifics() const | ||||
| { | ||||
|     if (m_gotCppSpecifics) | ||||
|         return; | ||||
|     m_gotCppSpecifics = true; | ||||
|  | ||||
|     CppModelManagerInterface *modelManager = CppModelManagerInterface::instance(); | ||||
|     if (CppEditorSupport *supp = modelManager->cppEditorSupport(m_editor)) { | ||||
|         if (QSharedPointer<SnapshotUpdater> updater = supp->snapshotUpdater()) { | ||||
|             updater->update(modelManager->workingCopy()); | ||||
|             m_snapshot = updater->snapshot(); | ||||
|             m_includePaths = updater->includePaths(); | ||||
|             m_frameworkPaths = updater->frameworkPaths(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user