forked from qt-creator/qt-creator
CMakePM: Fix "cm" and "cmo" locator filters
For "cm" (CMake Build) display all targets, including utility targets like "all", "clean", or "<target>_lupdate" and "<target>_lrelease". For "cmo" (CMake Open) display only the "real" targets, targets that are not utility targets and have a backtrace from CMake File-API. Fixes: QTCREATORBUG-29946 Change-Id: Ica53f4d38bd0c301b6dbfe0754e53c52d1b8d378 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -48,10 +48,6 @@ static LocatorMatcherTasks cmakeMatchers(const BuildAcceptor &acceptor)
|
||||
continue;
|
||||
const int index = target.title.indexOf(input, 0, Qt::CaseInsensitive);
|
||||
if (index >= 0) {
|
||||
const FilePath path = target.backtrace.isEmpty()
|
||||
? cmakeProject->projectFilePath()
|
||||
: target.backtrace.last().path;
|
||||
const int line = target.backtrace.isEmpty() ? 0 : target.backtrace.last().line;
|
||||
const FilePath projectPath = cmakeProject->projectFilePath();
|
||||
const QString displayName = target.title;
|
||||
LocatorFilterEntry entry;
|
||||
@@ -62,11 +58,20 @@ static LocatorMatcherTasks cmakeMatchers(const BuildAcceptor &acceptor)
|
||||
return AcceptResult();
|
||||
};
|
||||
}
|
||||
entry.linkForEditor = {path, line};
|
||||
entry.extraInfo = path.shortNativePath();
|
||||
bool realTarget = false;
|
||||
if (!target.backtrace.isEmpty() && target.targetType != UtilityType) {
|
||||
const FilePath path = target.backtrace.last().path;
|
||||
const int line = target.backtrace.last().line;
|
||||
entry.linkForEditor = {path, line};
|
||||
entry.extraInfo = path.shortNativePath();
|
||||
realTarget = true;
|
||||
} else {
|
||||
entry.extraInfo = projectPath.shortNativePath();
|
||||
}
|
||||
entry.highlightInfo = {index, int(input.length())};
|
||||
entry.filePath = cmakeProject->projectFilePath();
|
||||
entries.append(entry);
|
||||
if (acceptor || realTarget)
|
||||
entries.append(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user