forked from qt-creator/qt-creator
LanguageClient: also check for inherited mime types
... when trying to auto setup language servers as well when matching the configured mime types against a document mime type. In particular this fixes showing the auto setup editor info bar for the newly introduced clang format mime type as well as starting the yaml server for those files, since this clang format mime type inherits the yaml mime type. Change-Id: Id3ec64b0a1a128b070eadbcad600b3aaf4e667c3 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
This commit is contained in:
@@ -996,10 +996,16 @@ QString StdIOSettingsWidget::arguments() const
|
||||
return m_arguments->text();
|
||||
}
|
||||
|
||||
bool LanguageFilter::isSupported(const Utils::FilePath &filePath, const QString &mimeType) const
|
||||
bool LanguageFilter::isSupported(const Utils::FilePath &filePath, const QString &mimeTypeName) const
|
||||
{
|
||||
if (mimeTypes.contains(mimeType))
|
||||
return true;
|
||||
if (!mimeTypes.isEmpty()) {
|
||||
const MimeType mimeType = Utils::mimeTypeForName(mimeTypeName);
|
||||
if (Utils::anyOf(mimeTypes, [mimeType](const QString &supported) {
|
||||
return mimeType.inherits(supported);
|
||||
})) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (filePattern.isEmpty() && filePath.isEmpty())
|
||||
return mimeTypes.isEmpty();
|
||||
const QRegularExpression::PatternOptions options
|
||||
|
||||
Reference in New Issue
Block a user