forked from qt-creator/qt-creator
LanguageClient: move match function to language filter
Change-Id: I9081d441fa2f48e5a1c5273e2de2620e0b88c4e0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -719,4 +719,18 @@ QString StdIOSettingsWidget::arguments() const
|
||||
return m_arguments->text();
|
||||
}
|
||||
|
||||
bool LanguageFilter::isSupported(const Utils::FileName &filePath, const QString &mimeType) const
|
||||
{
|
||||
if (mimeTypes.isEmpty() && filePattern.isEmpty())
|
||||
return true;
|
||||
if (mimeTypes.contains(mimeType))
|
||||
return true;
|
||||
auto regexps = Utils::transform(filePattern, [](const QString &pattern){
|
||||
return QRegExp(pattern, Utils::HostOsInfo::fileNameCaseSensitivity(), QRegExp::Wildcard);
|
||||
});
|
||||
return Utils::anyOf(regexps, [filePath](const QRegExp ®){
|
||||
return reg.exactMatch(filePath.toString()) || reg.exactMatch(filePath.fileName());
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace LanguageClient
|
||||
|
||||
Reference in New Issue
Block a user