forked from qt-creator/qt-creator
LanguageServerProtocol: Replace two uses of FilePath::toUrlishString()
Change-Id: I21c7dc2186956a966d7c086192a446d840d3ab76 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -324,7 +324,7 @@ QTextCursor Range::toSelection(QTextDocument *doc) const
|
|||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString expressionForGlob(QString globPattern)
|
static QString expressionForGlob(QString globPattern)
|
||||||
{
|
{
|
||||||
const QString anySubDir("qtc_anysubdir_id");
|
const QString anySubDir("qtc_anysubdir_id");
|
||||||
globPattern.replace("**/", anySubDir);
|
globPattern.replace("**/", anySubDir);
|
||||||
@@ -343,7 +343,7 @@ bool DocumentFilter::applies(const Utils::FilePath &fileName, const Utils::MimeT
|
|||||||
if (fileName.caseSensitivity() == Qt::CaseInsensitive)
|
if (fileName.caseSensitivity() == Qt::CaseInsensitive)
|
||||||
option = QRegularExpression::CaseInsensitiveOption;
|
option = QRegularExpression::CaseInsensitiveOption;
|
||||||
const QRegularExpression regexp(expressionForGlob(*_pattern), option);
|
const QRegularExpression regexp(expressionForGlob(*_pattern), option);
|
||||||
if (regexp.isValid() && regexp.match(fileName.toUrlishString()).hasMatch())
|
if (regexp.isValid() && regexp.match(fileName.path()).hasMatch())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (std::optional<QString> _lang = language()) {
|
if (std::optional<QString> _lang = language()) {
|
||||||
@@ -352,7 +352,7 @@ bool DocumentFilter::applies(const Utils::FilePath &fileName, const Utils::MimeT
|
|||||||
};
|
};
|
||||||
if (mimeType.isValid() && match(mimeType))
|
if (mimeType.isValid() && match(mimeType))
|
||||||
return true;
|
return true;
|
||||||
return Utils::anyOf(Utils::mimeTypesForFileName(fileName.toUrlishString()), match);
|
return Utils::anyOf(Utils::mimeTypesForFileName(fileName.toFSPathString()), match);
|
||||||
}
|
}
|
||||||
// return false when any of the filter didn't match but return true when no filter was defined
|
// return false when any of the filter didn't match but return true when no filter was defined
|
||||||
return !contains(schemeKey) && !contains(languageKey) && !contains(patternKey);
|
return !contains(schemeKey) && !contains(languageKey) && !contains(patternKey);
|
||||||
|
Reference in New Issue
Block a user