forked from qt-creator/qt-creator
CMake: Delay initialization of CMakeTools
Do not run cmake 5 times during startup. Delay that as far as possible. Also add a supportedGenerators() method while visiting the code anyway. Fix up and simplify the other cmake help output parsers. Change-Id: I6622d552ffe559bf099b4b278618676a045e350e Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -46,8 +46,6 @@ using namespace ProjectExplorer;
|
||||
// -------------------------------
|
||||
// CMakeFileCompletionAssistProvider
|
||||
// -------------------------------
|
||||
CMakeFileCompletionAssistProvider::CMakeFileCompletionAssistProvider()
|
||||
{}
|
||||
|
||||
bool CMakeFileCompletionAssistProvider::supportsEditor(Core::Id editorId) const
|
||||
{
|
||||
@@ -56,31 +54,26 @@ bool CMakeFileCompletionAssistProvider::supportsEditor(Core::Id editorId) const
|
||||
|
||||
IAssistProcessor *CMakeFileCompletionAssistProvider::createProcessor() const
|
||||
{
|
||||
return new CMakeFileCompletionAssist();
|
||||
return new CMakeFileCompletionAssist;
|
||||
}
|
||||
|
||||
|
||||
CMakeFileCompletionAssist::CMakeFileCompletionAssist() :
|
||||
KeywordsCompletionAssistProcessor(Keywords())
|
||||
{}
|
||||
|
||||
IAssistProposal *CMakeFileCompletionAssist::perform(const AssistInterface *interface)
|
||||
{
|
||||
TextEditor::Keywords keywords;
|
||||
|
||||
Keywords kw;
|
||||
QString fileName = interface->fileName();
|
||||
if (!fileName.isEmpty() && QFileInfo(fileName).isFile()) {
|
||||
Utils::FileName file = Utils::FileName::fromString(fileName);
|
||||
if (Project *p = SessionManager::projectForFile(file)) {
|
||||
if (Target *t = p->activeTarget()) {
|
||||
if (CMakeTool *cmake = CMakeKitInformation::cmakeTool(t->kit())) {
|
||||
if (cmake->isValid())
|
||||
keywords = cmake->keywords();
|
||||
}
|
||||
}
|
||||
Project *p = SessionManager::projectForFile(Utils::FileName::fromString(fileName));
|
||||
if (p && p->activeTarget()) {
|
||||
CMakeTool *cmake = CMakeKitInformation::cmakeTool(p->activeTarget()->kit());
|
||||
if (cmake && cmake->isValid())
|
||||
kw = cmake->keywords();
|
||||
}
|
||||
}
|
||||
|
||||
setKeywords(keywords);
|
||||
setKeywords(kw);
|
||||
return KeywordsCompletionAssistProcessor::perform(interface);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user